Combining age (Bucketed) and age survey question. | XM Community
Skip to main content

Hi all,

I have 2 questions in the survey with age.

  1. 1st is a Bucketed variable. (Bucked from the age received through URL)
  2. 2nd is a a question asked in survey.

The 2nd question is asked if only “AGE” is not received through URL.

Both are in the below format.

  • 18-24
  • 25-34
  • 35-44
  • 45-54
  • 55-64
  • 65+

I would like to report this in dashboard combined. 

How will I combine both together.

Thank you

Praveen

After the age question,

  1. create a branching logic with a condition when a value comes from URL: set a embedded date with a respective group

     

  2. create another branching logic with a condition when a value do not come from URL and age question is answered: set a embedded date with a respective group

 

 

Now map the embedded data ‘Age_Concat’ in your dashboard as Text Set.

Hope this helps!


Thank you @Appzk 

It should work. I think there could be  a simpler solution like concatenate. Unfortunately the concatenate wont work for bucketed variable.

Would there be something similar?


See if this field ’Age_Concat’ can be used for bucketing or as Bucket field.


@ArunDubey @Deepak 

does this code help to take the numeric embedded data “TagAge” and populate the normal question “SurveyAgeS1” into the groupings.

 

Qualtrics.SurveyEngine.addOnload(function() {

  // Get the embedded data "TagAge"

  var age = parseInt("${e://Field/TagAge}"); // Assuming "TagAge" is stored as a numeric value in embedded data

  // Function to determine the text set for "agecombinedone" based on the age value

  function getAgeGroup(age) {

    if (TagAge >= 18 && TagAge <= 24) {

      return "18-24";

    } else if (TagAge >= 25 && TagAge <= 34) {

      return "25-34";

    } else if (TagAge >= 35 && TagAge <= 44) {

      return "35-44";

    } else if (TagAge >= 45 && TagAge <= 54) {

      return "45-54";

    } else if (TagAge >= 55 && TagAge <= 64) {

      return "55-64";

    } else {

      return "65+";

    }

  }

  // Get the question element for "SurveyAgeS1"

  var SurveyAgeS1 = jQuery("#"+this.questionId);

  // Populate the "SurveyAgeS1" question with the appropriate text set

  SurveyAgeS1.val(getAgeGroup(age));

});

 

 

This is not working. Could you please take a look with your expert eyes.


@ArunDubey @Deepak 

does this code help to take the numeric embedded data “TagAge” and populate the normal question “SurveyAgeS1” into the groupings.

 

Qualtrics.SurveyEngine.addOnload(function() {   // Get the embedded data "TagAge"   var age = parseInt("${e://Field/TagAge}"); // Assuming "TagAge" is stored as a numeric value in embedded data

  // Function to determine the text set for "agecombinedone" based on the age value   function getAgeGroup(age) {     if (TagAge >= 18 && TagAge <= 24) {       return "18-24";     } else if (TagAge >= 25 && TagAge <= 34) {       return "25-34";     } else if (TagAge >= 35 && TagAge <= 44) {       return "35-44";     } else if (TagAge >= 45 && TagAge <= 54) {       return "45-54";     } else if (TagAge >= 55 && TagAge <= 64) {       return "55-64";     } else {       return "65+";     }   }

  // Get the question element for "SurveyAgeS1"   var SurveyAgeS1 = jQuery("#"+this.questionId);

  // Populate the "SurveyAgeS1" question with the appropriate text set   SurveyAgeS1.val(getAgeGroup(age)); });

 

 

This is not working. Could you please take a look with your expert eyes.

You need to write age> or age < instead of TagAge within your function.
Hope this helps!


Leave a Reply