How Do I Dynamically Define the Data View Sort? (Magic xpa 4.x)
Magic xpa has powerful built-in sorting abilities. You can easily customize these for your end users using the SortAdd() and SortReset() functions.
-
Create a system to hold the sort order. In the example, each field is assigned a number between 1 and 3. A loop cycles 3 times, executing a SortAdd() for each field that matches the LoopCounter().
-
Create variables to hold the choice of Ascending or Descending.
-
Execute SortAdd() once for each field that will be added to the sort.
-
Raise the View Refresh event.
Use the SortReset() function to undo the Sort.
The Online and Rich Client Samples projects (program DV15 and RDV15)