Think of something that you wish Authorware could do but it doesn't? Let the our good friends at Macromedia know via the wishlist. Please let us know if you find any of the materials on this site inappropriate or offensive. Please include the url and why the material should be reviewed. Comments and questions about the site are also welcome. Please no Authorware questions, use the AWARE list. |
Back
1063 - Can 10 lists can be sorted using SortByValue? by - Joseph Ganci It's important to note for those who don't know that this function does
not sort each list separately in ascending or descending order. It only sorts
the first list, but it keeps the other lists synchronized. That means if you
have two lists: a1 := [2,3,1] and you use SortByValue(a1, a2) the results will be a1 = [1,2,3] Note that the value 3 in a2 is still synchronized with the value 1 in a1,
as it was to begin with. Both were in position 3 before the sort, now they're
both in position 1. That's a beautiful feature of the SortByValue function.
One application is to have data stored in different lists that need to stay
synchronized, such as names in one lists and phone numbers in another list,
id numbers in a third list, and so on up to 10 fields in 10 separate lists.
If someone wants to sort the names, you can keep all the lists synchronized
with the names list: SortByValue(names, idnumbers, phones, ...) If someone want to sort by phones, use the same approach, only make phones
first: SortByValue(phones, names, idnumbers, ...) Note that the order in which you place the lists to synchronize, outside
the first one, does not matter. This is also why the function requires that all the lists have the same
number of indices. It cannot obviously synchronize lists of different lengths.
Remember, the only list that is sorted the first time is a1. The others are
merely synchronized, they are are not considered sorted, so you could sort by
those lists later, e.g. do the above sorts one after the other. Add your review Back |