Question T7857
Visible to All Users

Is there an equivalent of choices from web option/ rows from question option for matrix type questions

created 3 years ago

I want to create a matrix question where the rows are people and the columns are salary brackets. However, the people will be chosen run time from another checkbox question that presents choices from web. Is there way to only show matrix rows for people selected in the checkbox type question so users of the survey can enter salary band information only for selected people

Answers approved by surveyjs Support

created 3 years ago

Hello,

This example on our site https://surveyjs.io/Examples/Library?id=condition-matrixVisibleIf&platform=Angular&theme=modern
demonstrates how to show matrix rows and columns depending on the selection from the previous questions.
Hope this help.

Thanks, Serge
SurveyJS Team

    Comments (2)
    A A
    AbhijitBhattacharya 3 years ago

      Hi - thanks for the answer but the example cited assumes that all options are static. In my case the answer choices for the checkbox question are sourced from web so I dont know what they will be at design time. Is there any way to link to choices in the checkbox question when the choices change run time?

        Hello,
        You will have to use survey.onValueChanged event. Here is the example.

        JavaScript
        survey.onValueChanged.add((sender, options) => {     if(options.name == "YourCheckboxQuestionName") {         const matrix = survey.getQuestionByName("YourMatrixQuestionName");         matrix.rows = options.question.selectedItems;     } })

        Thank you,
        Andrew
        SurveyJS Team