How could I pass a uncertain number of parameters to FastReport?

edited April 2011 in FastReport .NET
Hi Firends,
I need pass some parameters to Report, if the number of the parameters is certain, it's easy to do by using SetParameter function.
Here is the question, the number of parameters is uncertain and dynamic, setParaemter doesn't work now. how should I do?
using RegisterData, it doesn't work yet. the error message is as following:
Invalid expression term '['

To make the question clear, here is a example;
I put a CheckListBox on a form, then bind it with a table containing the name of some products, I hope when the user select the products he/she is interested with, the fastreprot could show the detailed specs of the selected products. but the point is that I cannot predict how many products the user will select, so I cannot predefin the equal number of parameters in fastreport designer, therefore the function setParameter fails to pass thees uncertain number of products.

It had bothered me a lot from last year.

Thanks for your help.

Jeff

Comments

  • pinbotpinbot Texas
    edited 5:20AM

    What I've done in similar instances is to create the SQL for my dataset on the fly and then replace the SQL in the dataset. I also pass some parameters.



    FastReport.Data.TableDataSource tds = (FastReport.Data.TableDataSource) Rpt.GetDataSource("VendorGuideSearch");
    tds.SelectCommand = sql;

    Rpt.SetParameterValue("MapIds", MapIds);
    Rpt.SetParameterValue("OrderBy", OrderByStr);
    Rpt.SetParameterValue("OrderDir", OrderDirStr);
  • edited 5:20AM
    pinbot wrote: »
    What I've done in similar instances is to create the SQL for my dataset on the fly and then replace the SQL in the dataset. I also pass some parameters.



    FastReport.Data.TableDataSource tds = (FastReport.Data.TableDataSource) Rpt.GetDataSource("VendorGuideSearch");
    tds.SelectCommand = sql;

    Rpt.SetParameterValue("MapIds", MapIds);
    Rpt.SetParameterValue("OrderBy", OrderByStr);
    Rpt.SetParameterValue("OrderDir", OrderDirStr);

    It works perfectly, thanks a lot.

    sunjie

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.