Adding multiple condition to a logic

0

I would like to create flags/ hidden values which are calculated using logics.

Is there any formula/html/java snippets which I can use in survey gizmo to calculate the hidden values.

Example problem:

Question 1:

gender?

  1. male
  2. female

Question 2 :

age?

  1. below 20
  2. above 20

I want to create a hidden value with some conditional statement which gives the following result :

 

if gender is male and age below 20 hidden value is set to be 1 else 0.

How do I do this using codes and not using the logic GUI?

IS answered
    0
    IS 2.20K Rep.

    One way to do this would be to add a custom scripting action (if available for your account level) on the page after your two questions and your hidden value with code something like the following:

    %%genderid = 6;
    %%ageid = 7;
    %%hiddenid= 8;

    if (sgapiGetValue(%%genderid) == “male” && sgapiGetValue(%%ageid) == “below 20”) {
    sgapiSetValue(%%hiddenid, 1);
    } else {
    sgapiSetValue(%%hiddenid, 0);
    }

    See:
    https://script.surveygizmo.com/help/sgapigetvalue
    https://script.surveygizmo.com/help/sgapisetvalue
    for more details. 

    NOTE: This forum changes normal straight quotes to left-quotes and right-quotes which breaks the code. If you copy and paste my example, be sure to replace all of the quote characters.

     

    IS answered
      ×

      Login

      Question stats

      • Active
      • Views477 times
      • Answers1 answer
      • Followers1 follower