Welcome to the LimeSurvey Community Forum

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

Calculate with assessment values within an IF statement

More
8 years 2 months ago #131368 by Ton
My survey contains 14 question groups.
At the end of the survey I display a result per question group in percentage.
For that purpose I have defined an equation type question (always hidden) summing up the assessment values of the answers.
e.g. DD1CALC for the question group DD1
So far so good... the percentage shows on the end page of the survey.

Now I would like to give the respondent some information at the end of the question group depending on the percentage achieved.
I therefore created an equation type question (not hidden) containing the following IF statement:
{if(DD1CALC<40,'You score less than 40% for these questions. You have still some work to do',if(DD1CALC>80,'You score more than 80% for these questions. You are well on the way !','You score average on these questions. I suggest you discuss your answers with your therapist'))}

This does not work. It appears as if EM can not evaluate the value behind my DD1CALC variable.
It does work if I copy the full calculation previously used in the definition of DD1CALC, but that means an incredible amount of work as my survey contains 128 questions in 14 different question groups.

Thanks a ton for any help.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 2 months ago #131370 by tpartner
Is DD1CALC placed before your group-statement equation type question?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
8 years 2 months ago #131381 by Ton
Hi Tony.
Thanks for your reply but DD1CALC is placed after the group-statement equation.
Hope you have an idea...
Regards
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 2 months ago - 8 years 2 months ago #131382 by holch
Well, here we go. If DD1CALC is placed after the question where you want to use it, how can this question use it? It is only calculated in the future...

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Last edit: 8 years 2 months ago by holch.
The topic has been locked.
More
8 years 2 months ago #131385 by Ton
Sorry. Got that wrong in my answer to you.
DD1CALC is calculated before I try to use it in my comments.
Hope you have an idea anyway.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 2 months ago #131388 by holch
Can you attach an example here? Of course not the 1.000.000 questions you mentioned, but one set, so we can look at it?

Which version of LS are you using?

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
More
8 years 2 months ago #131394 by Ton
Hi Holch,
Thanks for picking up my question.
Attached you find an extract of the survey.
The subject is pretty sensitive (the impact of sexual abuse on children).
I hope you had no such experience in your youth as it may then contain triggers for you.
We are using LS 2.06

in the example, question IFTEST1 works fine, but means an awful lot of work.
Question IFTEST2 is the way I would like to do it, but it doesn't work.

Looking forward to hearing from you again.
Have a great day.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 2 months ago #131398 by tpartner
I think the editor is messing with your "<" and ">" operators. Replacing them with "LT" and "GT" respectively and introducing a space before and after the operator seems to work.

Modified survey attached:

File Attachment:

File Name: limesurvey...2_TP.lss
File Size:37 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
8 years 2 months ago #131404 by Ton
Thanks again Tony, but to no avail....
Upon entering the first answer, the question disappears (??!!??) and never shows up again.
To take away some confusion, better to delete IFTEST1 as that one works and you may think that the problem is solved.
Hope you have some more ideas or am I approaching the border of what is possible with LS ?
Cheers, Ton
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 2 months ago #131406 by tpartner
Hmm...2 problems...

1) I modified "DD1CALC" and that broke the equation. :blush: I have fixed it in the attached.

2) The tfr_responsive template seems to be causing the disappearance. The attached works with the default and citronade templates.

File Attachment:

File Name: limesurvey...TP_2.lss
File Size:37 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • tammo
  • tammo's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
8 years 2 months ago #131508 by tammo
We also saw this behaviour. There is a new version of the template for LimeSurvey 2.06.

Could you be so kind to test this newest version? You can find it at:
www.toolsforresearch.com/limesurvey-responsive-template

greetings from The Netherlands,

Tammo


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 2 months ago #131515 by tpartner
Seems to work fine Tammo.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: tammo
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose