How could I pass a uncertain number of parameters to FastReport?
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
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
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