Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

list two maximum values using expression manager

  • lepsid
  • lepsid's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 2 months ago #211899 by lepsid
Hello. 
I need some help with printing the two highest values out of five. I assume that max function can be used in expression manager. I know how to print one highest value, but I don't know how to print the second highest value.

For example,
using this code below, I can print the highest value

{if(A==max(A,B,C,D,E),"A","")}
{if(B==max(A,B,C,D,E),"B","")}
{if(C==max(A,B,C,D,E),"C","")}
{if(D==max(A,B,C,D,E),"D","")}
{if(E==max(A,B,C,D,E),"E","")}

So, if the A is the highest value among A, B,C,D, and E, then A will be printed. But, I also want to define that the second highest value is also printed.
Is there any ideas or suggestions how to do it?
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #211900 by Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu, lepsid
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #211905 by DenisChenu
Replied by DenisChenu on topic list two maximum values using expression manager
@Joffm : excellent method !

Maybe find a good place in manual as "Expression sample survey" ?
manual.limesurvey.org/ExpressionScript_examples ?
 

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose