Blog
All Blog Posts | Next Post | Previous Post
Filtering Data in XData with TTMSFNCDataSetFilterDialog and Aurelius DataSet
Thursday, March 6, 2025
We previously showed how to use the TTMSFNCDataSetFilterDialog on a TDataSet, and now we want to show how you can quickly implement this filter dialog with an Aurelius DataSet.
When working with large datasets in TMS XData, efficient filtering is essential to enhance performance and user experience. The TTMSFNCDataSetFilterDialog provides a visual and intuitive way to filter records dynamically on client side with just one line. In this blog post, well explore how to integrate TTMSFNCDataSetFilterDialog with an Aurelius DataSet, requiring minimal setup.
Why use TTMSFNCDataSetFilterDialog?
With TTMSFNCDataSetFilterDialog, you can:
Easily apply filters to an Aurelius DataSet without manual SQL handling.
Provide users with a visual filtering UI instead of manual condition entry.
Seamlessly integrate advanced filtering logic, including AND/OR operations and type-specific filtering.
Automatically validate filter conditions before applying them.
Setting Up TTMSFNCDataSetFilterDialog with XData and Aurelius DataSet
The integration process is straightforward: assign the DataSet to the filter dialog and handle the filtering logic in the OnFilterRecord
event of the Aurelius DataSet.
Here you can find the source code which is an edited version of an already existing XData sample.
Step 1: Assign the DataSet to the Filter Dialog
This can be done in Design Time or programmatically:
DataSetFilterDialog.DataSet := AureliusDataset1;
Step 2: Implement the OnFilterRecord Event
To apply the filter dynamically, use the following code in the OnFilterRecord
event of the Aurelius DataSet:
procedure TAureliusDataSetFilterForm.AureliusDataset1FilterRecord(DataSet: TDataSet; var Accept: Boolean); var f: TField; inputArray: TArray<TTMSFNCValue>; begin SetLength(inputArray, DataSet.Fields.Count); for f in DataSet.Fields do inputArray[f.Index] := TValue.FromVariant(f.AsVariant); if DataSetFilterDialog.FilterText <> '' then Accept := DataSetFilterDialog.ValidateFilterRow(inputArray); end;
Step 3: Open the TTMSFNCDataSetFilterDialog
procedure TAureliusDataSetFilterForm.FilterBtnClick(Sender: TObject); begin DataSetFilterDialog.Execute; end;
How It Works
The
OnFilterRecord
event is triggered automatically for each record.The code converts field values into an array of
TTMSFNCValue
.The ValidateFilterRow function processes the array and determines whether the record should be included.
Conclusion
With just three simple steps, you can enable powerful, dynamic filtering for Aurelius DataSets in your TMS XData applications. The TTMSFNCDataSetFilterDialog enhances user experience by providing an intuitive, no-code filtering mechanism that integrates seamlessly into your applications.
Gjalt Vanhouwaert

This blog post has received 2 comments.


Gjalt Vanhouwaert
All Blog Posts | Next Post | Previous Post
HTTP Error 404.0 - Not Found
Pelletier Martin