Hi to all
Using CR XI and Oracle.
I need to extract the 1st, 2nd, 3rd, 4th, 5th positions of an array of 5 variables Array = [{@a},{@b},{@c},{@d},{@e}]. (those variables are sales totals per salesmen).
To get the highest and lowest values of this array, it is easy, using maximum and minimum functions.
I wrote complicated formulas to extract 2nd, 3rd and 4th positions.
Her is the code I used to extract the second highest value
Select Maximum(Array)
Case {@a}:
(
NewArray:=[{@b},{@c},{@d},{@e}];
Maximum (NewArray)
)
Case {@b}:
(
NewArray:=[{@a},{@c},{@d},{@e}]
Maximum (NewArray)
)
...
The formula for the third highest is the same kind of formula, but heavier, and I am lucky we have only 5 sales people.
I saw there is a function nthlargest but as I understood, it can only apply to fields, not to summaries, and does not work with arrays.
Does anyone know how to workaround this formula to have the same result in an array without writing so much code when we have ten sales people?
Thanks in advance
Using CR XI and Oracle.
I need to extract the 1st, 2nd, 3rd, 4th, 5th positions of an array of 5 variables Array = [{@a},{@b},{@c},{@d},{@e}]. (those variables are sales totals per salesmen).
To get the highest and lowest values of this array, it is easy, using maximum and minimum functions.
I wrote complicated formulas to extract 2nd, 3rd and 4th positions.
Her is the code I used to extract the second highest value
Select Maximum(Array)
Case {@a}:
(
NewArray:=[{@b},{@c},{@d},{@e}];
Maximum (NewArray)
)
Case {@b}:
(
NewArray:=[{@a},{@c},{@d},{@e}]
Maximum (NewArray)
)
...
The formula for the third highest is the same kind of formula, but heavier, and I am lucky we have only 5 sales people.
I saw there is a function nthlargest but as I understood, it can only apply to fields, not to summaries, and does not work with arrays.
Does anyone know how to workaround this formula to have the same result in an array without writing so much code when we have ten sales people?
Thanks in advance