Code: Select all
Data1.Filters.Add(new StiFilter());
Data1.Filters[0].Item = StiFilterItem.Expression;
Data1.Filters[0].Expression = "(ItemsSorted.Quantity < 0)";
Data1.FilterOn = true;
I can add the same filter from the Report Designer using the filter dialogue and get the results I want. However, when I try and give the user some control over filter values, the filters do not work at all. My goals are as follows:
1) The user will enter values in a form -- I will do the error checking,etc.
2) Based on the user values, I will constructed a String which I intend to use as a filter expression.
3) I want to be able to create the filter with the String as the filter expression (i.e. "Sales<100"), make it active and then allow the report to be viewed.
Do I need to set my filters in the BeforePrint event? Am I improperly setting filters? Is there a trick I am (most likely) unaware of?
Any thoughts?