Question T8233
Visible to All Users

Auto increment hidden Id

created 3 years ago (modified 3 years ago)

Hi,

We have Matrix (dynamic rows) to capture tenant settings. (Refer attached image)
Is possible to set an hidden auto incremental Id (from 0 to N-1) for each row?

Comments (2)

    Hello,

    Can you clarify your scenario? You can just iterate the matrix rows and use it index.

    Thanks, Serge
    SurveyJS Team

      We need a unique numeric - autogenerated/auto increment value on each row to use it as a reference key
      Survey Creator have input type number, Is there any option to add auto-increment property to that?

      Code
      { "Id": 1, "Code": "AST", "Name": "ASK International", "Locale": "en-US", "TimeZone": "America/New_York", "DefaultLanguage": "en-US", "ResourceFolder": "ASKInternational" }, { "Id": 2, "Code": "PAN", "Name": "PanDevs", "Locale": "en-US", "TimeZone": "America/New_York", "DefaultLanguage": "en-US", "ResourceFolder": "PanDevs" }

      Answers approved by surveyjs Support

      created 3 years ago (modified 4 days ago)

      Hello,

      You can hide this column:

      JSON
      { "pages": [ { "name": "page1", "elements": [ { "type": "matrixdynamic", "name": "question5", "columns": [ { "name": "Id", "visibleIf": "false" }, { "name": "Code" }, { "name": "Name" } ], "choices": [ 1, 2, 3, 4, 5 ] } ] } ] }

      and in the https://surveyjs.io/Documentation/Library?id=surveymodel#onMatrixRowAdded event handler set Id value according your requirements.

      Thanks, Serge
      SurveyJS Team