In Editable grid i need to add add row link in that i am getting error

a!localVariables(
  local!pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 20 
  ),
  local!gridData: a!queryEntity(
    entity: cons!BQA_Quiz_Cons,
    query: a!query(
      pagingInfo: local!pagingInfo
    ),
    fetchTotalCount: true
  ),
  a!formLayout(
    label: "Example: Add,Update, or Remove Employee Data",
    contents: {
      a!gridLayout(
        
        headerCells: {

          a!gridLayoutHeaderCell(label: "Chapter Name"),
          a!gridLayoutHeaderCell(label: "File Upload"),
          a!gridLayoutHeaderCell(label: "Description"),
          a!gridLayoutHeaderCell(label: "Total Questions")
        },

        columnConfigs: {

          a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
          a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
          a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
          a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 )

        },
        rows: a!forEach(
          items: local!gridData,
          expression: a!gridRowLayout(
            contents: {


              a!textField(
                label: "chapterName" & fv!index,
                value: fv!item.chapterName,
                saveInto: fv!item.chapterName,
                required: true
              ),

              a!fileUploadField(
                label: "fileUpload" & fv!index,
                value: fv!item.fileUpload,
                saveInto: fv!item.fileUpload,
                required:true
              ),
              a!textField(
                label: "totalQuestion" & fv!index,
                value: fv!item.totalQuestion,
                saveInto: fv!item.totalQuestion,
                required:true
              ),

              a!textField(
                label: "description" & fv!index,
                value: fv!item.description,
                saveInto: fv!item.description,
                required:true
              ),
            },
            id: fv!index
          )
        ),
        addRowlink: a!dynamicLink(
          label: "Add Employee",

            value: {
              chapterName: "",
              fileUpload: {},
              totalQuestion: "",
              description: ""
              },
          saveInto: {
            a!save(local!gridData, append(local!gridData, save!value))
          }
        ),
        rowHeader: 1
      )
    },
    buttons: a!buttonLayout(
      primaryButtons: a!buttonWidget(
        label: "Submit",
        submit: true
      )
    )
  )
)
 in this code when clicking add employee i am getting this error how to resolve this

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Senior Developer
    in reply to balamanchari murugadas

    When you Query the output comes in as "DataSubset". Same thing is happening in your case .Type of local!griddata is "DATASUBSET". And when you are trying to add another row, save!Value is of your CDT type. It leads to Casting error

    I Just observed it in your grid is it showing the right data?? and when you try to update, is it happening properly without any errors?? I mean your index needs to look like this fv!item.data.chaptername .  

Children
No Data