Value reported by Equation Question

More
2 years 10 months ago #116315 by chakali
chakali created the topic: Value reported by Equation Question
Our survey generates a long random string using the Expression Manager ({join(ceil(time()/floor(rand(1000,999999))), substr("abcdefghijkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ", -rand(1,48),1), substr("abcdefghijkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ", -rand(1,48),1),substr("abcdefghijkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ", -rand(1,48),1), ceil(time()/floor(rand(1000,999999))))}).

The problem is that when this is exported in our results, the expression is re-evaluated, so the exported result disagrees with the value the user sees when taking the survey. The only fix I could find is to have the user cut and past the random string into a short-text field which is then properly stored in the results. Is there a better way to store the value of the expression so that what appears in the results agrees with what the user saw on the screen?

Thanks!

Please Log in to join the conversation.

More
2 years 10 months ago #116316 by fransmarcelissen
fransmarcelissen replied the topic: Value reported by Equation Question
I hope that I understand what you mean, but if use the expression as the default value of a text field, the expression is evaluated just once. The text field gets a random value and that is it.
Frans
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

More
2 years 10 months ago #116317 by chakali
chakali replied the topic: Value reported by Equation Question
I haven't tried using the expression as the default value of the text field. I was simply making the survey respondent cut and paste the random string into the text field.

Originally, I tried using an Equation Question type, since this records the value of the equation and returns it in the results report. Unfortunately, when i do this, the reported value in the results is not the value seen by the survey respondent, it is some *other* random value generated using the same expression.

Please Log in to join the conversation.

More
2 years 10 months ago #116318 by chakali
chakali replied the topic: Value reported by Equation Question
I tried creating a hidden Equation Question to store the random value. I could then display it in text and display it as the default value in a short-text field. When I to this I get the same random string displayed in running text AND as the default text field AND reported in the results file. (I need to know the value of the random string seen by the survey respondent.) The results file also includes a value for the hidden question. The value for that random string, as reported in the results file, is different from the one reported for that question in the visible question that follows it.

So using the default value of a short text field to report the random string will help me get around this problem! Many thanks.

Please Log in to join the conversation.

More
2 years 10 months ago #116320 by fransmarcelissen
fransmarcelissen replied the topic: Value reported by Equation Question
Glad to hear that this solves your problem. But why so complicated? Why do'nt you enter your EM string directly as the default value of the question? You do'nt need the equation question.
Frans

Please Log in to join the conversation.

More
2 years 10 months ago #116322 by DenisChenu
DenisChenu replied the topic: Value reported by Equation Question

chakali wrote: Originally, I tried using an Equation Question type, since this records the value of the equation and returns it in the results report. Unfortunately, when i do this, the reported value in the results is not the value seen by the survey respondent, it is some *other* random value generated using the same expression.

Strange ?

If it's real with the last version, can you make a example lss file ?
Did the survey have complete index ?

Denis

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).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
2 years 10 months ago #116324 by chakali
chakali replied the topic: Value reported by Equation Question
I'm using Version 2.05+ Build 140811. The lss file I attach will report a random string on the survey web page that is different from the value if the results from an active survey are reported by exporting a CSV file.

If I put the {TheRandomValue} in a short answer question, then it appears the same as it is reported in the results CSV file. If I do the same using a simple text question (what I tried first), the CSV results disagree with what was shown on the survey.
Attachments:

Please Log in to join the conversation.

More
2 years 10 months ago #116326 by DenisChenu
DenisChenu replied the topic: Value reported by Equation Question
Yep,

No bug here.

The random value shown to user are the randomValue at start of the page, but when you show the page : randomValue are updated, and again when backup.

You just need to put the randomValue BEFORE showing it. (you can sow it too in last page)

Denis
PS: lss fixed attached

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).
An error happen ? Before make a new topic : remind the Debug mode .
Attachments:

Please Log in to join the conversation.

More
2 years 10 months ago #116332 by chakali
chakali replied the topic: Value reported by Equation Question
Thanks for the help!

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!