Previous Topic: Load SORT DataNext Topic: FILTER and UNFILTER Statements


User Defined SORT Sequence

 --- EVENT ACTION sort_open
|    SET LAST OF export_sort_to TO 0
 --- SET output_sort metadata ascend_descent TO “A”

 --- EVENT ACTION sort_1b_export_sort_doubleclick
|    GET ROW HIGHLIGHTED IN export_sort_from STARTING AT 1 GIVING SUB SCRIPT OF
|        export_sort_from
|    SET SUBSCRIPT OF export_sort_to TO LAST OF export_sort_to + 1
|    MOVE export_sort_from_line metadata TO export_sort_to_line metad ata
|    SET export_sort_to_ line metadata ascend_descend TO input_sort metadata
|        ascend_descend
|
|     --- IF input_sort metadata ascend_descend IS EQUAL TO “D”
|    |
|     --- SET export_sort_to_line metadata name TO
|             concat (trim(export_sort_to_line metadata name),   “(D)”)
 ---

 --- EVENT ACTION sort_pb_sort_click
|    SET local_sort_argument ief_supplied sort_string TO SPACES
|     --- FOR SUBSCRIPT OF export_sort_to FROM 1 TO LAST OF export_s ort_to BY:
|    |    SET local_sort_argument ief_supplied sort_string TO
|    |        concat (trim(local_ sort_argument ief_supplied sort_string),
|    |        concat (“ “, concat(export_sort_to_line metadata number,
|     ----    concat (“ “, export_sort_to_line metadata ascend_descent))) )
|
|     --- IF local sort_argument ief_supplied sort_string IS GREATER THAN SPACES
|    |     --- CASE OF output_sort metadata entity_type
|    |    |--- CASE “ACCOUNT”
|    |    |--- SORT export_account BY local_sort_argument ief_supplied sort_string
|    |     --- OTHERWISE
|     ---
 --- CLOSE Dialog Box sort

The sample code shows four event handlers:

When building user-defined sort preferences, provide logic in the action diagram that allows a user to “undo” a selection.

SORT and FILTER each work on group views, not on a database. Thus, the occurrences that are being sorted or filtered may only be a subset of the data that should be sorted or filtered. It may not be possible for all the data to be returned to the group view.

The group view should be large enough to handle all occurrences that are to be sorted or filtered. This can be done for entity types whose number is small (usually low thousands at most) or by pre-filtering the occurrences that are to be sorted/filtered as they are read. Therefore, the SORT or FILTER statements will not always be used when sort and filter type logic is needed.