When a question is not "relevant" because of conditions or relevance equation, it is never posed to a user, and Limesurvey inserts a <NULL> in the response column for the current row.

In cases where a question IS relevant, is non-mandatory, and the user does not answer, Limesurvey is supposed to insert a zero-length string in the response column for the current row. This distiguishes a "no answer" from a "non-relevant."

This works correctly for list questions, multi-choice, and text questions. But for numeric questions, it is inserting a <NULL> when user skips a relevant, non-mandatory question.

Steps To Reproduce

Create a numeric or multi-numeric question.
Make sure it is not mandatory
Run the survey and skip the question
Look at the database and check the record.
It will show <NULL> rather than empty

Additional Information

I checked and this works the same way in 1.91, so it must be a long-standing issue. Maybe there is a reason, but it does not seem consistent. There is no way for us to distinguish non-responses from non-relevants when exporting the data.

Tags

No tags attached.

Activities

I found a comment in the code about this (for 1.91, 1.92, and 2.0). Whenever a numeric or multple numeric is blank, we intentionally write NULL to the database. The stated reason is:
"some databases can't store blanks in numerical inputs"

For example, if you try to use PhpMyAdmin to store a blank in a float field, it sets the value to 0, which is not what we want.

Of course, yet another option would be to just store numbers are varchar(), but that would probably require changes to the statistics module.

So, for now, you can't tell the difference between irrelevant and unanswered questions for numeric and multiple numeric.

Thanks Tom. I had a feeling that there was probably a reason and that changing it could bring about all types of unintended consequences. Definitely would not want zeros in there. In our database we just check of a "NO-RESPONSE" flag to indicate an empty response, as opposed to a non-relevant.

In any case, it isn't critical with numerics because we aren't doing frequency distributions that need to add up to 100% after accounting for relevance. So we can just throw out NULL numerics and do processing with what we have.