Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

20.14 Changing the Record Selection Filter

Changing the Record Selection Filter

The record selection filter tells Crystal Reports which records you want to include in the report’s output. Any records not matching the the record selection filter are excluded. The RAS lets you change the filter with a single statement: RecordFilterController.SetFormulaText(). To change the grouping formula, use the GroupFilterController.SetFormulaText() method. The next two listings demonstrate this.

Listing 20-11. Changing the record selection formula.
[VB.NET]
Private Sub ModifyFilter(ByVal NewFilter As String, ByVal rcd As ISCDReportClientDocument)
rcd.DataDefController.RecordFilterController.SetFormulaText(NewFilter)
End Sub
[C#]
private void ModifyRecordFilter(string NewFilter, ISCDReportClientDocument rcd)
{
rcd.DataDefController.RecordFilterController.SetFormulaText(NewFilter);
}
Listing 20-12. Change the group selection formula.
[VB.NET]
Private Sub ModifyFilter(ByVal NewFilter As String, ByVal rcd As ISCDReportClientDocument)
rcd.DataDefController.GroupFilterController.SetFormulaText(NewFilter)
End Sub
[C#]
private void ModifyGroupFilter(string NewFilter, ISCDReportClientDocument rcd)
{
rcd.DataDefController.RecordFilterController.SetFormulaText(NewFilter);
}