Check out the LimeSurvey source code on GitHub!

Relevance equation of Equation question type

3 years 3 weeks ago - 3 years 3 weeks ago #104358 by jonaskoeppel
Dear community,

I encountered a more or less severe problem today. I'm using questions of the type Equation to calculate indexes based on previous answers. For the indexes to be correct they should be calculated only if certain conditions are met (previous questions answered, etc.). So I use the Relevance Equation of the corresponding question which works fine in the survey. If the conditions aren't met, the Equation question doesn't show.

Now my problem: I realized that the corresponding fields of the irrelevant questions aren't NULLED in the database. Sometimes the value is set to "0", sometimes to "NAN". So apparently the Relevance Equation of this question type doesn't work properly.

Can anyone tell me if this is a planned behavior of LS or a bug?

Maybe I've got to mention that I've got the $deletenonvalues setting deactivated but this doesn't cause problems with other question types. I've deactivated it because I need information being saved even if the question group becomes irrelevant afterwards. Now if I do that, the values of the Equation questions are set to "0" or "NAN" while the information of other question types is preserved as wanted.

Thanks in advance for your answers!

Last Edit: 3 years 3 weeks ago by jonaskoeppel.

Please Log in to join the conversation.

3 years 3 weeks ago #104359 by jonaskoeppel
Forgot to add the survey file. If I run this survey and answer the first question (test1) with "No" (or no answer) the value in the database for the third question (test3) is "0".

File Attachment:

File Name: test_relev...tion.lss
File Size:13 KB

Please Log in to join the conversation.

3 years 3 weeks ago #104360 by DenisChenu
Hi Jonas,

Seams you're rigth ....
ANd more : if you put {test2.NAOK * 20 + 30} for Équation : 30 is set to Answer.

No problem with deletenonvalue at true.

I'm not sure it can be easily fix, but i think if Équation question are never shown : we must let NULL inside value.
I test with Équation in a second group : same thing here.


Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

3 years 3 weeks ago #104362 by jonaskoeppel
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

3 years 2 weeks ago #104430 by jonaskoeppel
Since the bug report was closed (won't fix) and I don't dare to reopen it again I'm continuing here since for me, unfortunately, the issue isn't resolved.

In fact, the way I see it or at least the reason I deactivated deletenonvalues is because I want to preserve the information once saved even if the question becomes irrelevant. With the actual behavior of the Equation question though, my values aren't preserved anymore but overwritten by senseless values (0, NAN). So for me, following this logic, the equation shouldn't evaluate at all instead of cleaning it up retrospectively.

I understand the hesitations of Carsten very well though, it seems not to be a simple bug. So I ask myself, what can I do to fix this for my purpose? Does the plug-in you mentioned, Denis, follow the same logic?

Thanks a lot for your support!


Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form