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

TOPIC: Conditional array (numbers)

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

  • tfj
  • tfj's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 80
  • Thank you received: 6
  • Karma: 5
Please find the simple 4-question survey I made up attached. The first two questions are yours. The second 2 questions are mine (in a separate group).

If I had to guess what I am missing, it is that, in your questions, you have to hit the submit button after the first question in order to register it. This would make sense, but since we have quite a few questions, it would be tedious for the survey taker to have to hit the "submit" button after each 12-month question. Maybe this means that I won't be able to use this feature in the manner I would like. At any rate, I am not sure why the Survey Logic file is flagging my 12-month question code as "undefined."

Thanks!

tfj
Attachments:
The administrator has disabled public write access.

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

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
Column 2 of the Survey Logic File shows the variable names for each question and sub-question. Since you are using Array Numbers, it gets a little tricker, since the name is the sq name, followed by an underscore, followed by the answer name. So, since you using a 1x1 array numbers matrix (presumably so that you can use the pick list of numbers), the variable name for "In the 12 months before you entered this treatment program ... " is s12_1_1, so your equation should be:
if(s12_1_1 == 12,1,0)

BUT, one last problem - we can't generate the list of drop-down options dynamically, so you can't use equations for min/max values in array numbers unless you use the text input option. And, if you use that option, you might as well use multiple numeric input instead of array(numbers).
The administrator has disabled public write access.

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

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
Actually, there is a way to skin this cat. See attached.

File Attachment:

File Name: limesurvey_survey_747521.lss
File Size: 31 KB


It uses static value for your min/max (0-30), but uses the new Sub-Question Validation Feature to implement this validation rule:
this >= if(s12_1_1 == 12, 1, 0)

Here is a screen shot of smoking less than 12 months:

smoke_3m.jpg


And if you change to 12 months:

smoke_12m_0d.jpg


And now the corrected values:

smoke_12m_7d.jpg
The administrator has disabled public write access.

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

  • tfj
  • tfj's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 80
  • Thank you received: 6
  • Karma: 5
I greatly appreciate your time in helping me figure this out. I wanted to keep trying it on my own until I had it fixed, so that I could learn this feature better, but my results are different from yours, even though I tried to copy your solution as closely as possible.

The problem is that the tip message appears in the 30-day question even before anything is selected in the 12 month question.

Attached are screen shots of:

1) The relevant section of my survey logic file
2) The two questions I tried your approach on. I have many more to go, but wanted to test it first.

I figure you will take a quick look at this and see the problem right away, but it is eluding me.

Thanks!

tfj
Attachments:
The administrator has disabled public write access.

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

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
Looks like you're doing a group-level preview rather than testing the full survey (or your submitted the page, it had an error, and was re-displayed). Group-level preview used to show those validation messages, but we fixed that prior to the 120613 release.
The administrator has disabled public write access.

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

  • tfj
  • tfj's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 80
  • Thank you received: 6
  • Karma: 5
You are correct: my screen shot came from the Group-level preview, but the same behavior was exhibited when I went through the actual survey itself. The group of questions is so far into the survey that it takes quite a while to get there, so I used the Group-level preview to make up the previous screen shot.

I have attached another screen shot, this time from the full survey itself. You'll be able to see that it looks the same. Maybe it matters that the survey is not activated (?). I didn't want to activate it until I made all of the changes.

I am using 1.92, build 120613. From your note, it looks like this issue was fixed prior to this release.

Thanks!

tfj
Attachments:
The administrator has disabled public write access.

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

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5331
  • Thank you received: 296
  • Karma: 249
TMSWhite wrote:
Actually, there is a way to skin this cat.
It uses static value for your min/max (0-30), but uses the new Sub-Question Validation Feature to implement this validation rule:
this >= if(s12_1_1 == 12, 1, 0)
Tom, can you explain this solution a little more?

Where do you add this expression, what does it do and how can one generally use the "this" operator?

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'"
Last Edit: 2 years 4 months ago by Mazi.
The administrator has disabled public write access.

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

  • tfj
  • tfj's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 80
  • Thank you received: 6
  • Karma: 5
I thought I had a flash of inspiration while at a meeting last night, but, unfortunately, it didn't work. My thought was that I am using a customized template that I have carried over since version 1.87 and that maybe it didn't include elements it needed in the new version.

This morning, I modified a copy of the default template just enough to see if that would address the issue of the warning message appearing prior to the person answering either the 12-month or the 30-day question. The new template made no difference.

(Side note: I know I ran across in the documentation or forum somewhere what to add to existing templates to make them up-to-date. Do you know where that is?)

In order to meet my deadlines, I could change the warning message to say "If you answer 12 months in the previous question, you must choose at least 1 day in this 30-day question." This solution is not as elegant as yours, but at least it might get me through the crunch.

Any thoughts?

Thanks!

tfj
The administrator has disabled public write access.

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

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5331
  • Thank you received: 296
  • Karma: 249
tfj wrote:
(Side note: I know I ran across in the documentation or forum somewhere what to add to existing templates to make them up-to-date. Do you know where that is?)
From docs.limesurvey.org/Upgrading+from+a+pre..._v1.0_through_v1.44_
Special checks after an upgrade:
from any earlier version to 1.92: The templates have been changed in a lot of places. Please check your customized templates if they are still looking right. If not you will have to edit your templates accordingly (check out the original templates to see what was changed)
from a version earlier than v1.53: When upgrading from a version before v1.53 to the latest version, please check the global user rights of each user. There was a new superadmin right introduced in v1.53 that can give a user the same privilege as the master administration account created during the install. The upgrade script is guessing who to give this right to in the older versions. As this is not perfect, it should be carefully checked.

More update instructions: docs.limesurvey.org/Upgrade+hints+for+version+1.92

As for the templates it is hard to say what has to be added/changed/overworked if you are using a customized template. You can compare it to the default template or ask for some expert help to update your template, see e. g.: www.limesurvey-consulting.com/template-design/

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.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.287 seconds
Donation Image