Query Filter: When do I set this at runtime?
I have report (FR4.7) where all the data is coming from the DATA tab of a report (designtime). (using for example TfrxADOQuery)
When opening the report I'd like to set the filter (in code) for the query based on a variable that I pass to the report.
What event would be the right event to do this without ending up with either an empty dataset or an unfiltered dataset?
When opening the report I'd like to set the filter (in code) for the query based on a variable that I pass to the report.
What event would be the right event to do this without ending up with either an empty dataset or an unfiltered dataset?
Comments
in the parameter editor set the type and in the value box select the variable.
then you can pass a value into the report when loading it
or use the onactivate event of the report dialog or you can use values from dialog form controls directly in the param editor.
see the main demo internal datasets internal query for an idea.
Thanks again for the quick reply [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> Using parameter doesn't work. The value is either =0 or >0. I do use parameters quite a lot - wonderful way of working ... (like usual Delphi queries) Passing variables is something I also use - I'd like the report to be as stand-alone as possible so it's not depending on the queries on my Delphi form (thanks for implementing the DATA tab!). I think I'll rewrite the queries to <=0 or <=9999999 ... not pretty, but it should work. I was just curious if the filter of a query on the data tab could be set at runtime (of the report).[/img]
another method is to set the visibility of the databand in its obp event
ie:
masterdata1.visible := (<datasetname."fieldname">) > 0