Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Conditional array (numbers)

Conditional array (numbers) 2 years 4 months ago #81793

  • tfj
  • tfj's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 80
  • Thank you received: 6
  • Karma: 5
I'm sure this has been asked before, but I have not had luck with my search. If someone could provide a link, I would appreciate it.

We have several 12-month and 30-day questions, using the Array (Numbers) question type. By logic, if someone answers that they did something for all 12 of the past 12 months, they would have had to do that something for at least 1 of the last 30 days. Right now, the 30-day question's answer always goes from 0 to 30, regardless of how many months was answered before.

Here is a clarifying example:

A person answers that they smoked for 12 months out of the past 12 months.
In the next question, they are asked, "How many days in the last 30 days did you smoke?" They have the option of 0 to 30, whereas, in reality, the option should be 1 to 30. If they had answered 11 out of 12 months, then the answer choices for 30 days would be 0 to 30.

I am using 1.92+, build 120608.

Is there a simple way to accomplish this?

tfj
The administrator has disabled public write access.

Re: Conditional array (numbers) 2 years 4 months ago #81794

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
Use an expression in the min_num_value_n field. Examples using that option are seen here.

So, min_num_value_n value would be (assuming your question about # of months smoked in the last year is called "monthsSmoked")
if(monthsSmoked==12,1,0)

and max_num_value_n would be
30
The administrator has disabled public write access.

Re: Conditional array (numbers) 2 years 4 months ago #81801

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5331
  • Thank you received: 296
  • Karma: 249
...and once you have set this up successfully, please add your example at docs.limesurvey.org/Expression+Manager+E...ples_for_Expressions

Thanks!

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re: Conditional array (numbers) 2 years 4 months ago #81807

  • tfj
  • tfj's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 80
  • Thank you received: 6
  • Karma: 5
I have looked through the documentation, reviewed the example surveys for Expression Manager, clicked on the "Expression Manager" in LimeSurvey and poked around, and all but hopped on one foot (lol). So far, I have not seen where "min_num_value_n" is for my array (numbers) question. I am missing the most fundamental piece -- how do I get to the screen that displays this so that I can enter the condition for my question?

I think if I had this one piece, I could be on my way to learning this new feature.

Thanks!

tfj
The administrator has disabled public write access.

Re: Conditional array (numbers) 2 years 4 months ago #81819

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
Edit the question, click on "Show advanced settings". min_num_value_n is labeled "Minimum value". max_num_value_n is labeled "Maximum value". Both are in the "Input" section of the advanced settings
The administrator has disabled public write access.

Re: Conditional array (numbers) 2 years 4 months ago #81823

  • tfj
  • tfj's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 80
  • Thank you received: 6
  • Karma: 5
I figured it might be that, but I was taking the label literally. My first shot at it didn't work, but I will keep at it until it does, now that I know I was in the right location.

Thanks!

tfj
The administrator has disabled public write access.

Re: Conditional array (numbers) 2 years 4 months ago #81824

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5331
  • Thank you received: 296
  • Karma: 249
See...

minnumvalue.png

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re: Conditional array (numbers) 2 years 4 months ago #81826

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
Try this.

File Attachment:

File Name: limesurvey_group_675.lsg
File Size: 7 KB
The administrator has disabled public write access.

Re: Conditional array (numbers) 2 years 4 months ago #81845

  • tfj
  • tfj's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 80
  • Thank you received: 6
  • Karma: 5
Thank you (and Mazi) for your support.

I am still having no luck, although I tried to pattern a couple of test questions as closely as possible to the example you provided. When I run the Survey Logic file, I get the error message that the variable is undefined. This is referring to the question code of the previous question.

Here are some of the things I have tried, through trial-and-error:

1) Changed the questions from Array (Numbers) type to Numerical Input type, as in your example. That didn't work, so I changed them back to Array (Numbers), as in my original.

2) Shortened the question codes from my original, to match the length of your question codes. (My original was made up of 5 characters, which I didn't think would make a difference).

To explain, I have a larger multiple choice question at the head of a series of question, that, through a series of conditions, cause the following questions to appear or not. The examples I made up for your review are from the series of many of the following questions. If the person selects in the larger question that they smoked, for example, the 12-month and the 30-day questions appear.

We have been using this survey (with annual modifications) for about three years with no unsolvable issues. Since I am up against a deadline (for this fiscal year's modifications), I may have to resort to simply adding a warning to the help message. I am hoping, though, to figure this out.

I have attached my example that I made up, for your review. My guess is that you will see something glaringly obvious.

Thanks!

tfj
Attachments:
The administrator has disabled public write access.

Re: Conditional array (numbers) 2 years 4 months ago #81870

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
I wasn't able to import your .lsg file - it said it was improperly formatted.

Did the group I attached work for you? If not, there is something funny going on with your install.

If my group did work, please either attach a copy of the survey, or a screen-shot of the Show Logic File report that shows the question with the error, and the question(s) it is trying to refer to.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.242 seconds
Donation Image