Welcome, Guest
Username: Password: Remember me

TOPIC: Inserting variables in IF formulas - keeping variables alive

Inserting variables in IF formulas - keeping variables alive 2 months 3 weeks ago #112086

  • tgrecu
  • tgrecu's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 2
  • Karma: 0
Please take a look at this formula i'm trying to implement.

{if(Q1 == 0, "you answered Q1.shown and this is wrong","you answered Q1.shown and this is correct")}


If the answer has value 0 the answer is wrong and i want to show some text containing the variable Q1 so that the selected answer is displayed.

Problem is, i can't find a way to make the EM understand Q1 is a variable when i put it inside the "quotes"



I found very long workarounds, so i'm asking if any of you knows how to keep variables alive inside of columns, when using formulas.
The administrator has disabled public write access.

Inserting variables in IF formulas - keeping variables alive 2 months 3 weeks ago #112089

Hi Tgrecu,
I always use
{if(Q1 == 0, join("you answered ",Q1.shown," and this is wrong"),
join("you answered", Q1.shown," and this is correct"))}

but sprintf (see manual.limesurvey.org/Expression_Manager) or implode(' ',.....) should also work.

Succes
Frans
Last Edit: 2 months 3 weeks ago by fransmarcelissen.
The administrator has disabled public write access.
The following user(s) said Thank You: tgrecu
Moderators: ITEd
Time to create page: 0.109 seconds
Donation Image