Salesforce

How Do I Determine the Order of the Records Retrieved from the Database? (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

How Do I Determine the Order of the Records Retrieved from the Database? (Magic xpa 4.x)

When you display a list of records, the order in which those records are retrieved is usually very important. The record order is important from a user interface perspective, in that the user will want to see the records in a way that makes the most sense to the task. The record order is also important from a functional perspective, in that you will want the records to be retrieved in a way that is the most efficient for the filtering being done.

In Magic xpa you can have very fine control over the record ordering. There are two main ways this happens, each of which will be covered individually:

  • Setting the table index

  • Using the task sort

Setting the Table Index

When you use a Data source in a task, either as a Main source or a Linked source, you will specify the index to use in the Index property. In this example, the Suppliers will be fetched by Supplier_Code.

For the Main source, it is most efficient to use the Index that works best for the Range you are using. For a Linked source, it is most efficient to use the Index that works with the Locate used in the Link. In our example, using Supplier_Code for the Index would be best if we are looking for, say, Suppliers where Supplier_Code is from A001 to A003.

Using the Task Sort

The Task Sort allows you to re-order the records after the initial record selection is done. The Task sort is extremely flexible. For instance, you can create a virtual that is initialized to some value, and use that virtual in the Sort.

To set up a Task sort:

  1. Go to Task->Sort (Ctrl+T).

  2. In the left hand column, press F4 to open up a line.

  3. Select the variable you want to participate in the sort, from the list on the right.

  4. If the field is long, you can choose to sort on only the first few characters in the Size column.

  5. If you want to reverse the sort order, select Descending in the Direction columns.

  6. Continue selecting variables as needed.

Now, when the task runs, the records will be sorted before the user sees them. In our example, they will be sorted by the third character of the Supplier name.

See also:

Reference
Attachment 
Attachment