lists gts
Since v1.0.11
Available on all platforms
See also

The SORTBY function sorts a list according to a value returned by a macro. The macro must return a value of the same type (LONG, DOUBLE or STRING) for each element.

Before release 1.2.22, the SORTBY function could only sort lists of Geo Time Series™.



// // Create 3 Geo Time Series // 1 3 <% NEWGTS SWAP TOSTRING RENAME 1 100 <% NaN NaN NaN RAND ADDVALUE %> FOR %> FOR 3 ->LIST // Add mean and std as attributes, only here to check the result. <% DROP DUP false MUSIGMA [ 'mu' 'sigma' ] STORE { 'mu' $mu TOSTRING 'sigma' $sigma TOSTRING } SETATTRIBUTES %> LMAP // // Sort the GTS according to their mean // <% false MUSIGMA DROP %> SORTBY