Focal Point
Controlling Sort Order

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6791098331

September 20, 2005, 03:36 PM
smkt591
Controlling Sort Order
Can you control the sort order by the order in which the user entered the data? If so, how?

I have an HTML-generated input form where the user enters 3 or more text fields for, say, car manufacturers:

Mercedes Chevrolet Volkswagen

The report automatically sorts the output alphabetically with the BY CAR_MFCT command. How can I use amper variables (the number varies) to sort by the order of the user input?
September 20, 2005, 04:01 PM
Tony A
Depends upon what data you have in your table. If you have a timestamp then sorting is easy.

If you mean that the form is supplying multiple values in the form &var, &var0, &var1, &var2 etc. from a multi select combo box then you can utilise the count in &var0 to build an FML (aka EMR etc.) report to control the rows of data -

-DEFAULT &var = 'ENGLAND';
-DEFAULT &var0 = 4;
-DEFAULT &var1 = 'ENGLAND';
-DEFAULT &var2 = 'JAPAN';
-DEFAULT &var3 = 'FRANCE';
-DEFAULT &var4 = 'W GERMANY';

TABLE FILE CAR
SUM RCOST DCOST
FOR COUNTRY
-SET &Cnt = 0;
-REPEAT :Loop1 &var0 TIMES ;
-SET &Cnt = &Cnt + 1;
'&var&Cnt.EVAL' WHEN EXISTS OVER
-:Loop1
""
END

If this is not what you mean then more detail please and we'll try to assist.
September 20, 2005, 04:03 PM
<Steve Cowell>
There is a ROWS element to the BY functionality in the same way as the is for ACROSS with columns, you could use the user input var to control this.
Hope this helps. Steve C