Welcome, Guest
Username: Password: Remember me

TOPIC: Choosing correct question codes for arrays in expression manager

Choosing correct question codes for arrays in expression manager 1 year 6 days ago #98473

  • pedro1
  • pedro1's Avatar
I'm having difficulty choosing the correct question code for a response in an array and I was hoping someone might be able to help me figure it out.

I'd like to display conditional text in the end message (using Expression Manager) for respondents that select 5 out of a 1-5 rating scale for all three questions that are set up as arrays.

{if(THISPARTINEEDHELPWITH,"We are glad we could help ...","We are sorry that you are not ...")}

I have attached a screenshot of the logic file which displays the questioncodes.

Thankyou in advance.
Attachments:
The administrator has disabled public write access.

Choosing correct question codes for arrays in expression manager 1 year 5 days ago #98474

  • JEfromCanada
  • JEfromCanada's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 39
  • Thank you received: 3
  • Karma: 0
Your screen shot implies that a VALUE can be attached to each answer. So, if you assign a VALUE to each subquestion (a value from 1 to 5), then you can calculate the SUM of the three question values.


Use something like {sum(info_1.value, treated_1.value, recommend_1.value)} to assign a numeric value to a question variable via a "hidden" equation. For this example, say the question variable is "evalsum"

Then, in your summary, you can say something like {if(evalsum == 15, "We are glad we could help...", "We are sorry that you are not...")}

I use version 1.92+ and you don't way which version you're on, so this might not work for you.
Last Edit: 1 year 5 days ago by JEfromCanada. Reason: Misspelled a variable name in code example
The administrator has disabled public write access.

Choosing correct question codes for arrays in expression manager 1 year 5 days ago #98483

  • pedro1
  • pedro1's Avatar
Thanks for the prompt reply. I'm almost there. I'm using version 2.00

I've created a hidden question called "evalsum" with the equation below

{sum(info_1.value, treated_1.value, recommend_1.value)}

and I've inserted the conditional into the end message as below, pasted into source rather than html.

{if(evalsum == 15, "We are glad we could help...", "We are sorry that you are not...")}

and I'm getting only the "We are sorry that you are not..." as the message even with all responses being 5/5

I have attached a screenshot of the question logic of the hidden question, can I ask if that is the correct way to set a variable?
Attachments:
The administrator has disabled public write access.

Choosing correct question codes for arrays in expression manager 1 year 5 days ago #98495

  • JEfromCanada
  • JEfromCanada's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 39
  • Thank you received: 3
  • Karma: 0
I'm not really familiar with version 2.0, since I use 1.92+.

However, your screen shot seems to show what I would call the Expression Logic, not the actual input screen for the expression (at least, not what the input screen looks like in version 1.92). Specifically, I don't see the brace brackets surrounding the "sum" formula. Without the brackets, I believe the string "sum(info_1.value, treated_1.value, recommend_1.value)" might be assigned to the evalnum variable, rather than the numeric value.

To check what's actually happening, you should create a dummy text message consisting of a debug statement that will show you the value of evalnum after the computation.

Something like "The value of evalnum is {evalnum}"

That will let you know what is going on.

Also, my instructions assumed that you were assigning values (1 through 5) to your initial question choices. In your original post, according to your screen dump, all the [values] were set to 0. This whole thing won't work properly until you assign the appropriate values to the appropriate answers.
Last Edit: 1 year 5 days ago by JEfromCanada.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.098 seconds
Donation Image