--- 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:
The event handler sort_lb_export_sort_doubleclick moves the available field to selected fields list box. This shows the user the sort sequence that is being constructed.
The last event handler is triggered when the user clicks on the sort push button in the sort dialog box.
It builds the sort argument character expression. The expression would be constructed as “3 A 4 A” if the preferred sort sequence was account type (the third field in the view) and account number (the fourth field in the view).
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.
|
Copyright © 2013 CA.
All rights reserved.
|
|