Question T12935
Visible to All Users

Matrix question response based on the selection.

created 2 years ago (modified 2 years ago)

Hi, Is there any possibilities to save matrix question response based on the selected value.

Sample JSON :

Code
{ "type": "matrix", "name":"MatrixQuestionArray", "columns": [ { "value": "Yes", "text": { "default": "Yes" } }, { "value": "No", "text": "No" } ], "rows": [ { "value":"option1", "default": "option1", }, { "value": "option2", "text": "option2" }, { "value": "option3", "text": "option3" }, { "value":"option4", "text": "option4", } ] },

currently i'm getting all the details in MatrixQuestionArray like below:
Current Behaviour
"MatrixQuestionArray": {"option1": "No", "option2": "Yes", "option3": "Yes", "option4": "No"},

but, Instead of this i'm looking for below format.
Expected Behaviour

"MatrixQuestionArray": [
"option2",
"option3"
]

Answers approved by surveyjs Support

created 2 years ago

Hi Salai,
You can use the getPlainData function to access survey results on completion and build a custom response object which would contain Yes options only. For more information on how to access and modify survey results, refer to the following help topic: Modify Survey Results.

Please let me know if you have any questions or require further assistance.

Thanks

    Comments (2)
    SS SS
    Salai soundarya 2 years ago

      Do you have any sample working code for getting plain data?

        Hello Salai,
        survey.data property and survey.getPlainData() function return JSON object. You can modify it as you want based on your needs.

        Thank you,
        Andrew
        SurveyJS Team