![]() |
Powered by QM on a Rpi server |
|
KnowledgeBase 00085: Sorting Dynamic ArraysThis article was originally published as a Tip of the Week. There is frequently a need to sort a list of items that is held in a dynamic array. The !SORT() subroutine provides this functionality. The !SORT() SubroutineThe subroutine is called asCALL !SORT(in.list, out.list, sort.rule)where
Example
CUSTOMER.LIST = "" SELECT INVOICES LOOP READNEXT ID ELSE EXIT READ INVOICE.REC FROM INVOICES, ID THEN CUSTOMER.LIST<-1> = INVOICE.REC<CUSTOMER.NAME> END REPEAT CALL !SORT(CUSTOMER.LIST, CUSTOMER.LIST, "AU")The above program fragment reads all the records from the INVOICE file and builds a list of customer names. This is then sorted, removing duplicates. Related ArticlesNone. |