View Issue Details

This issue affects 1 person(s).
 10
IDProjectCategoryView StatusLast Update
07252Bug reportsOtherpublic2013-01-31 14:15
ReporterAnaben11 Assigned Toc_schmitz  
PriorityhighSeverityminor 
Status closedResolutionfixed 
Product Version2.00+ 
Summary07252: using rand() and mandatory simultaneously
Description

The survey is supposed to show one randomly chosen question from a pool of 31 questions. This random question needs to be set on "mandatory".
The problem is that, if you answer the random question and click on the next-button to get forwarded to the next question group, the next question from the pool of now 30 remaining questions is asked. This continues until all questions are asked, instead of just one.

In the random question I use rand(1,31), the relevance equations for the other questions are set to randnumber.NAOK==x.

Thank you for your help.

TagsNo tags attached.
Attached Files
445519_30_01_1600.lss.xml (126,039 bytes)
mand_error.PNG (4,597 bytes)   
mand_error.PNG (4,597 bytes)   
Bug heat10
Complete LimeSurvey version number (& build)130129
I will donate to the project if issue is resolvedNo
Browser
Database type & versionmysqlnd 5.0.8-dev - 20102224
Server OS (if known)Linux web102 3.0.51-0.7.9
Webserver software & version (if known)didn't manage to find out
PHP Version5.3.14
Git branch / Pull Request URL

Users monitoring this issue

There are no users monitoring this issue.

Activities

c_schmitz

c_schmitz

2013-01-30 20:07

administrator   ~23903

In the advanced question settings of the equation question type you can set that numbers are returned only - otherwise the comparison will be against strings and that's why it does not work.
Please use the forums next time first, thank you.

Mazi

Mazi

2013-01-31 11:44

updater   ~23910

Hi Carsten,

thanks for the hint. I have imported the attached survey, set the related question attribute to numbers only as suggested and then activated and tested the survey (using latest Limesurvey 2 version).

At some of my tests I wasn't able to proceed after having answered the first question. Though an answer was given, the mandatory warning shows up.

So there seems to be some problem with the mandatory validation. Can you have another look?!
Thanks!

c_schmitz

c_schmitz

2013-01-31 12:04

administrator   ~23912

I did not have that problem. It is also completely unrelated to this issue.

DenisChenu

DenisChenu

2013-01-31 13:29

developer   ~23917

Last edited: 2013-01-31 13:31

Confirmed:

  • Add a equation question type, put {rand(1,100)} in equation (code: RANDOM).
  • Add another equation question type, and put {RANDOM} in equation.

The 2 question have different number 99 time for 100.

Upload test survey
limesurvey_survey_rand.lss

Alternative:
{if(RANDOM.NAOK,RANDOM.NAOK,rand(1,100)} and it work....

TMSWhite

TMSWhite

2013-01-31 13:37

reporter   ~23918

This is not a bug. See http://www.limesurvey.org/en/forum/design-issues/82187-problems-randomising-survey-using-rand and http://docs.limesurvey.org/Expression+Manager+Sample+Surveys#Randomly_Ask_One_Question_Per_Group

The reason is that the rand() function is called each time the page is visited AND each time it is validated, so you get different values with each call unless you use a syntax like this which ensures that rand() is called only once:

{if(val>0,val,rand(x,y))}

Anaben11

Anaben11

2013-01-31 13:47

reporter   ~23919

ok, it doesn't seem to be a bug. Sorry for bringing this topic up then.
In any case, there is a solution:
I created two groups, the first one consists only of the equation question with rand(1,31).
The second one consists of the question pool and each question has the relevance equation randnumber.shown==1-31

Like this it seems to work pretty well so far.

Thank you for your help!

Issue History

Date Modified Username Field Change
2013-01-30 15:59 Anaben11 New Issue
2013-01-30 15:59 Anaben11 File Added: 445519_30_01_1600.lss.xml
2013-01-30 20:07 c_schmitz Note Added: 23903
2013-01-30 20:07 c_schmitz Status new => closed
2013-01-30 20:07 c_schmitz Assigned To => c_schmitz
2013-01-30 20:07 c_schmitz Resolution open => no change required
2013-01-31 11:44 Mazi Note Added: 23910
2013-01-31 11:44 Mazi Status closed => feedback
2013-01-31 11:44 Mazi Resolution no change required => reopened
2013-01-31 11:45 Mazi Status feedback => assigned
2013-01-31 11:46 Mazi File Added: mand_error.PNG
2013-01-31 11:47 Mazi File Added: limesurvey_survey_137956_Mazi.lss
2013-01-31 12:04 c_schmitz Note Added: 23912
2013-01-31 12:04 c_schmitz Status assigned => closed
2013-01-31 12:04 c_schmitz Resolution reopened => fixed
2013-01-31 13:29 DenisChenu Assigned To c_schmitz =>
2013-01-31 13:29 DenisChenu Note Added: 23917
2013-01-31 13:29 DenisChenu Status closed => feedback
2013-01-31 13:29 DenisChenu Resolution fixed => reopened
2013-01-31 13:30 DenisChenu File Added: limesurvey_survey_rand.lss
2013-01-31 13:31 DenisChenu Note Edited: 23917
2013-01-31 13:31 DenisChenu Note Edited: 23917
2013-01-31 13:37 TMSWhite Note Added: 23918
2013-01-31 13:47 Anaben11 Note Added: 23919
2013-01-31 13:47 Anaben11 Status feedback => new
2013-01-31 14:15 c_schmitz Status new => closed
2013-01-31 14:15 c_schmitz Assigned To => c_schmitz
2013-01-31 14:15 c_schmitz Resolution reopened => fixed