Support Forums

We encourage an open exchange of information. Ask your questions or make suggestions. We are here to help, but we also encourage all of you to help one another.
Click on the Subscribe Flag to be notified by email of replies to your post.
Current User: Guest Login Register
Please consider registering

Documentation for advanced show/hide syntax

Add a New Topic Reply to Post
UserPost

4:27
October 15, 2008


kkaufman

Member

posts 6

I am considering purchasing the Pro plan and am trying out SurveyGizmo's product features. The product looks great but I'm spending an awful lot of time scouring the website for basic documentation.

At the moment I'd like to set up some show/hide rules based upon a few conditions, but can't seem to find any documentation on how to construct the syntax and reference previous questions and answers.

Is there documentation that I'm not aware of?

Thanks, Kathy

7:15
October 15, 2008


cheri

Moderator

posts 592

Hi, Kathy,

 

For now, here's some instruction for Advanced Show/When rules:

 

Advanced Show/When is best used for setting up rules that are based on answers from more than one question on a previous page of the survey.

 

The rules for Advanced Show/When logic will look something like this:

 

('[%%12:question%%]' > 32 AND '[%%13:question2%%]' < 32 ) OR '[%%2:gender%%]' == 'Male' 

 

The first element of the rule is the merge code for the question (e.g.[%%12:question%%]).  

 

To find the merge code for the questions in your Show/When rule, go to each question that will be part of the rule and click the Advanced Edit icon (the little notebook on the left side of the question).

 

When the question opens up, on the right side of the Question Title box you will see a smaller box. Click the link at the bottom of that box that is labeled 'Select a Variable'. A dropdown box will appear. Set the dropdown to the question that you wanting the merge code for.

 

The merge code will appear under the box. Copy that merge code and add it to your rule.

 

The next part of the rule is the ‘operator’ (e.g. >):

== : Equal to

!= : Not Equal to

>  : Greater than

<  : Less than

>= : Greater than or equal to

<= : Less than or equal to

 

The last element of the rule is the value (e.g. 32, Male). This value is derived from the reporting value of your question and must match the reporting value exactly, including capitalization.

 

You can merge statements in the rule with the ‘AND’ and ‘OR’ operators.  ‘AND’ says both statements must be true for the whole statement to (process) evaluate to true.  ‘OR’ says either statement can be true for the whole statement to evaluate to true.

 

If a rule is true, the page will be shown.

 

Numeric values in the rule do not need single quotes (e.g. 32) while values that are not numbers (e.g. 'Male') need to have single quotes around them. 


A word of caution: If you construct your rules in a Word document and then paste them into the survey editor, the single quotes may need to be deleted and re-typed. The single quote from Word sometimes does not register properly  which means the logic won’t work in your survey.

 

I hope this helps. 

 

–Cheri

2:05
October 16, 2008


kkaufman

Guest

It did help me begin to muddle through. In the process of implementing your suggestion, a few additional syntactical requirements suggested themselves and I would appreciate your verifying them:

  • It appears that the merge code for a question is not available using the pull-down menu on the page associated with the question itself, but only on the page associated with a subsequent question.
  • Are single quotes are required around the merge code as well as the value? I received an error until I bracketed the merge codes with single quotes.
  • Are the tag lines at the top of each paragraph in your post (e.g. <!–[if !supportEmptyParas]–><!–[endif]–>) something I should be including in the syntax somewhere?

Thanks for clarifying,

Kathy

6:49
October 16, 2008


Mario

Moderator

Boulder, CO

posts 610

correct, you can't get the merge code for the question you are currently viewing without going to a later question.

Single quotes are only required if the merge code and value should be evaluated as a string. 'bob' is a string. 7 is not.

<!–[if !supportEmptyParas]–><!–[endif]–> Is not part of the syntax, not sure where you got that info.

Have a good day!

6:59
October 16, 2008


kkaufman

Guest

The tags were from Cheri's post (above yours). Thanks for the verification. Kathy

10:09
October 16, 2008


James

Guest

Hello,

I am using the Pro version of SurveyGizmo, and I have spent the past couple of hours trying to get a simple Advanced Show/When display control to work. Although I am new user, this should not be an inherent difficult task. I have followed cheri's guidelines above with no success at all–and have tried to troubleshoot this as best I can. Could someone answer the following questions (or please, please direct me to some sort of online guidance for this elementary problem–which I have not yet been able to find):

1) Is the exact spacing necessary for the syntax (it is hard to tell in cheri's post what this should be).

2) Will the merge code for an acutal question actually look like “[&& 26:When did yo &&]“? If not, what I am doing wrong?

Note that I am dealing with a multiple selection question (call this question 28): I would like a subsequent question (call this question 29) to display if and only if some subset of the answer choices are selected for question 28. I have assigned integers to the reporting values for the choices to question 28, and am using these intergers in the advanced show/Hide syntax for question 29.

Thanks in advance for your help.

James


10:28
October 16, 2008


Mario

Moderator

Boulder, CO

posts 610

James,

Can you provide the exact name of the survey you are adding this to so we can look at the actual code you have written? I think at this point it may be some minor syntax issues and possibly correcting one of your codes may give you a point of comparison. Also, include any info regarding the question numbers that include this advanced logic. Thanks!

1) Exact spacing is not required, just easier to read. usually we include a space between each side and the operator (== for instance).

2) [%%26:Some words %%] is what a merge code would look like. edit any question, click select a variable on the right side of the question title editor, and you can see the merge codes for any question prior.


11:11
October 16, 2008


kkaufman

Member

posts 6

Hi James,


I've only been playing with SurveyGizmo for 2 days, but below is the syntax that worked for me.


If one condition or the other is true, the question will be hidden (skipped).


Note that the software pastes in merge code — in this case [%%3:Do you have a c %%] into the window, but you will need to bracket it with single quotes. I used == as an operator. Then used exactly the text string that appeared as the question option in my survey — No — also enclosed in single quotes.


'[%%3:Do you have a c %%]'=='No' OR '[%%14:Please check al %%]'=='none of the above'


Hope that helps!

Kathy


James said:

Hello,

I am using the Pro version of SurveyGizmo, and I have spent the past couple of hours trying to get a simple Advanced Show/When display control to work. Although I am new user, this should not be an inherent difficult task. I have followed cheri's guidelines above with no success at all–and have tried to troubleshoot this as best I can. Could someone answer the following questions (or please, please direct me to some sort of online guidance for this elementary problem–which I have not yet been able to find):

1) Is the exact spacing necessary for the syntax (it is hard to tell in cheri's post what this should be).

2) Will the merge code for an acutal question actually look like “[&& 26:When did yo &&]”? If not, what I am doing wrong?

Note that I am dealing with a multiple selection question (call this question 28): I would like a subsequent question (call this question 29) to display if and only if some subset of the answer choices are selected for question 28. I have assigned integers to the reporting values for the choices to question 28, and am using these intergers in the advanced show/Hide syntax for question 29.

Thanks in advance for your help.

James



12:13
October 17, 2008


James

Guest

Thank you for your help, Kathy and Mario. 

Here is a link to the survey:

The issue is that there is a multiple selection question on page 25. I would like page 26 to display if and only if certain conditions are met (i.e., iff A, B, and C, but not D are selected for the question on page 25).

While troubleshooting, I found I was able to get show/when syntax to work when the question on page 25 was single select. I cannot get it to work when the question is multiple select (as it needs to be).

Of course, another workaround would be if I could use a symbol for Boolean AND in the basic show/when command area. I don't know what this is, though.


James

12:43
October 17, 2008


kkaufman

Member

posts 6

I think the syntax would be:

'[%%14:Please check al %%]'=='Ajax' AND  '[%%14:Please check al %%]'=='Palmolive' AND  '[%%14:Please check al %%]'=='Dove' AND  '[%%14:Please check al %%]'<>'none of the above'

Note that to reference the option selected on a previous question, you are inserting the actual label that appears on the questionnaire.

2:05
October 17, 2008


cheri

Moderator

posts 592

Hi, James.

Ahh. The issue here is that Advanced Show/When does not work with checkboxes. Simple Show/When will work with them, but not Advanced Show/When. You cannot use the AND in the Simple Show/When rule, either.

–Cheri

2:16
October 17, 2008


kkaufman

Member

posts 6

Hi Cheri,

But then I'm even more confused. Why does my rule work — which does reference an option selected in a checkbox question?:


'[%%3:Do you have a c %%]'=='No' OR '[%%14:Please check al %%]'=='none of the above'

3:40
October 17, 2008


cheri

Moderator

posts 592

Hi, Kathy.

The reason your rule works is because your rule is looking for either:

1. Only the FIRST VALUE  in the list of checkboxes or

2. Only one specific value from the entire list of checkbox questions.

When you start dealing with multiple checkbox answers at once, then Advanced Show/When rules won't work with checkboxes.

It does get confusing.

–Cheri

4:00
October 17, 2008


kkaufman

Member

posts 6

Thanks for the clarification. What would be the best way then to test for multiple checkbox answers?

4:14
October 17, 2008


cheri

Moderator

posts 592

Hi, Kathy.

You will need to go with either Advanced Page Jumping and Logic (An Add Action) and use a rule with a 'contains' operator or use simple page jumping. It will depend on what you are trying to do.

–Cheri

Add a New Topic Reply to Post


Reply to Topic: Documentation for advanced show/hide syntax

Guest Name (Required):

Guest EMail (Required):

Guest URL (required)

Math Required!
What is the sum of: 7 + 10        (Required)

Topic Reply:


 
© Simple:Press Forum - Version 3.1.4 (Build 357)