[Solved] Building “age groups” based on numeric question

0

Dear GizmoCommunity,

I would like to create a hidden “age groups”-question (radio button) based on the answers of a numeric question (open text field) which is asked before.

For example:

All participants who typed in >=25 and <=34 should be group “25-34 years”.

( ) 18-24 years

( ) 25-34 years

( ) 35-44 years

 

Is there a special Merge Code which has to be insert to “Default Answer”?

 

Best regards,

Chris

Christian selected answer

    Best answer

    0

    1st page

    Numeric Question: id=8 (open text field for age)

     

    2nd page (automatically submit page)

    1) Hidden Value (id=2529)

    [question(“value”), id=”8″]

    2) Custom Script

    %%age = sgapiGetValue(2529);

        if (%%age >= 18 && %%age <= 24)
        {
            sgapiSetValue(2531,”18-24 years”);
        }

        if (%%age >= 25 && %%age <= 34)
        {
            sgapiSetValue(2531,”25-34 years”);
        }

        if (%%age >= 35 && %%age <= 44)
        {
            sgapiSetValue(2531,”35-44 years”);
        }

        if (%%age >= 45 && %%age <= 54)
        {
            sgapiSetValue(2531,”45-54 years”);
        }

        if (%%age >= 55 && %%age <= 64)
        {
            sgapiSetValue(2531,”55-64 years”);
        }

        if (%%age >= 65)
        {
            sgapiSetValue(2531,”65 years and older”);
        }

     

     

    3rd page (admin-only page)

    Single Question: id=2531 (age groups)

    Christian edited answer
      0

      Hi Chris,

      If i understand your question correctly, you will need a custom script to accomplish this action.

      This script would first have to get the respondent’s answer from the open text box, evaluate it to see which age group pertains, and then place the appropriate age-group value in the hidden question. 

      You can use Merge Codes to define default answers, but what you are describing goes well beyond that. 

      Jim W (Moderator) answered
        ×

        Login

        Question stats

        • Active
        • Views5360 times
        • Answers2 answers
        • Followers1 follower