- Posts: 7
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Value reported by Equation Question
- chakali
- Topic Author
- Offline
- New Member
Less
More
9 years 3 months ago #116315
by chakali
Value reported by Equation Question was created by chakali
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!
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!
The topic has been locked.
- fransmarcelissen
- Offline
- Premium Member
Less
More
- Posts: 113
- Thank you received: 46
9 years 3 months ago #116316
by fransmarcelissen
Replied by fransmarcelissen on 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
Frans
The following user(s) said Thank You: DenisChenu
The topic has been locked.
- chakali
- Topic Author
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
9 years 3 months ago #116317
by chakali
Replied by chakali on 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.
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.
The topic has been locked.
- chakali
- Topic Author
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
9 years 3 months ago #116318
by chakali
Replied by chakali on 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.
So using the default value of a short text field to report the random string will help me get around this problem! Many thanks.
The topic has been locked.
- fransmarcelissen
- Offline
- Premium Member
Less
More
- Posts: 113
- Thank you received: 46
9 years 3 months ago #116320
by fransmarcelissen
Replied by fransmarcelissen on 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
Frans
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13668
- Thank you received: 2496
9 years 3 months ago #116322
by DenisChenu
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 , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Value reported by Equation Question
Strange ?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.
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 , plugin development .
I don't answer to private message.
The topic has been locked.
- chakali
- Topic Author
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
9 years 3 months ago #116324
by chakali
Replied by chakali on 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.
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:
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13668
- Thank you received: 2496
9 years 3 months ago #116326
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on 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
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 , plugin development .
I don't answer to private message.
Attachments:
The topic has been locked.
- chakali
- Topic Author
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
9 years 3 months ago #116332
by chakali
Replied by chakali on topic Value reported by Equation Question
Thanks for the help!
The topic has been locked.