Question T16973
Visible to All Users

Master data dropdown choices are showing as undefined after deleting dynamic matrix row

created a year ago (modified a year ago)

Hi Team,

Master data dropdown choices are showing as undefined after deleting dynamic matrix row, and that is reason for All country name this expression is not working =>

expression: "concatInArray('Static panel Question', 'Column 1',';')",

Can you please have a look? Sharing sample demo, Here Dynamic matrix First column is master dropdown and value of 'All country name ' depends on this master dropdown column and on delete of dynamic matrix row, 'All country name ' is getting empty, as we have choice coming as undefined!

https://codesandbox.io/p/sandbox/surveyjs-angular-forked-nv6y4z?file=%2Fsrc%2Fapp%2Fcomponents%2Fjson.ts

Clipboard-File-1.png

Clipboard-File-2.png

Show previous comments (3)
AT AT
Andrew Telnov a year ago

    Hello Santosh,
    In the code you gave us there is no getCombinedQuestionValues and getSeparator functions. As result we can't compile your code.
    Further, we don't have masterdata_dropdown question type and in the demo the cell question renders as a "text" question
    Could you please provide an example that generates the error? We can't find the reason of the error if we can't reproduce this error.

    Thank you,
    Andrew
    SurveyJS Team

      Hi Andrew,

      Can you just help us understand after deleting dynamic matrix row, why choices are getting empty for matrix column =>

      const question = this.survey?.findQuestionByName(quesName) as Question;

      Problem will get resolved automatically, if we get this!

      AT AT
      Andrew Telnov a year ago

        Hello Santosh,
        I am sorry, are you trying to get the cell question using this.survey?.findQuestionByName(quesName) code? This function will return a top level question only.
        To get the cell you will need to write a function that will pass (1) question name (matrix), (2) column name, (3) row visible index (number).

        JavaScript
        function getCellQuestion(questionName: string, columName: string, rowIndex: number): Question { const matrix = this.survey.getQuestionByName(questionName); if(!matrix || !Array.isArray(matrix.visibleRows)) return null; const rows = matrix.visibleRows; if(rowIndex < 0 || rowIndex >= rows.length) return null; return rows[rowIndex].getQuestionByName(columnName); }

        I did not try this function, but it should work.

        Thank you,
        Andrew
        SurveyJS Team