Question T13576
Visible to All Users

Logic tab : implement conditions with the help of variables.

created 2 years ago

Hi,

I want to filter questions in a survey with the help of user info like age, marital status, gender etc. Right now I am using variables for this.
This is working fine. My question is how to give choices for variable. Like when I select condition as Gender there should be options like male and female. Clipboard-File-1.png
Here title 'Question' does not make sense and is it possible to get a drop down here.
Clipboard-File-2.png

Answers approved by surveyjs Support

created 2 years ago

Hello Aparna,
Unfortunately, we don't have this functionality out of the box. I guess, we need to add an event to allow you customize the value question for variables. I think we need to add ability to customize value question for any condition item.
Let us discuss it with the team and we will be back to you.

Thank you,
Andrew
SurveyJS Team

    Show previous comments (1)

      Hello Aparna,
      In fact, we have already an event that you can use to solve the issue. It is creator.onConditionQuestionsGetList event.
      Here is the example and code with this event:

      Code
      const variableSurvey = new Survey.Model({   elements:[     {name: "gender", title: "Gender"type"dropdown", choices: ["male""female"]}   ] }); creator.onConditionQuestionsGetList.add((sender, options) => { const questions = variableSurvey.getAllQuestions(); questions.forEach(q => { options.list.push({name: q.name, title: q.title, question: q}); }); });

      Thank you,
      Andrew
      SurveyJS Team

      A A
      Aparna Namdev Jadhav 2 years ago

        Thanks Andrew. I think this will work.

          Great!

          Andrew
          SurveyJS Team