TdxCustomMemData.SortedFields Property
Specifies one or more fields against which the TdxMemData component sorts data.
Declaration
property SortedFields: string read; write;
Property Value
Type | Description |
---|---|
string | The delimited string of target dataset fields and sort syntax flags. |
Remarks
Use the SortedFields
property to specify one or multiple dataset field names separated by semicolons to sort data. The order of listed field names defines the order in which multiple sort operations are processed.
Sort Order and Case Sensitivity
The SortOptions property allows you to modify the behavior of sort operations for all dataset fields listed in the SortedFields
property. The SortOptions property value can include the following flags in any combination:
- soDesc
The TdxMemData component sorts data against all listed fields in descending order, except for fields followed by a colon and the
'A'
or'a'
sort order syntax flag.If the flag is omitted, the component sorts data in ascending order, except for listed fields followed by a colon and the
'D'
or'd'
sort syntax flag.- soCaseInsensitive
The TdxMemData component ignores character case for sort operations against all fields listed in the SortedFields property value.
If this flag is omitted, sort operations are case-sensitive, except for those fields followed by a colon and the
'N'
or'n'
sort syntax flag.
Sort Syntax Flags
The SortedFields
property supports a number of syntax flags that allow you to customize sort operation settings for individual target fields. You can specify one or multiple syntax flags without delimiters after a field name followed by a colon.
Code Example: Sort Data Against One Field
The following code example sorts data against the CustomerName field in descending order without case sensitivity:
Supported Sort Syntax Flags
'A'
|'a'
- The component sorts data in ascending order against the corresponding field.
'D'
|'d'
- The component sorts data in descending order against the corresponding field.
'N'
|'n'
- The sort operation against the corresponding field is case-insensitive.
Code Example: Sort Data Against Multiple Fields
The code example below defines a sort operation against CustomerName (in descending order), Quantity (in descending order), and UnitPrice (in ascending order) fields. The 'N'
syntax flag defines case-insensitive sorting against the CustomerName field.
Design-Time Functionality
You can use the SortedFields
property’s editor dialog available at design time to preview and manage the list of sorted fields and their sort syntax flags. Click the ellipsis button to the right of the SortedFields
property in the Object Inspector to invoke the dialog.
A click on the Add button invokes a pop-up menu populated with available field names that you can click to add or remove them to/from the SortedFields
property value. Ascending, Descending, and Case Insensitive buttons manage sort syntax flags for a selected field. Move Down and Move Up buttons rearrange listed fields to change the order of sort operations.
Limitations
The TdxMemData component does not support sort operations against calculated fields.
Default Value
The SortedFields
property’s default value is an empty string.