Paging grid validations

Certified Senior Developer

Hi,

I have a old CDT

sno|sname

1|qef

2|abc

I should create a grid field showing sno by default and enter sname against sno which needs to input by user.

I should provide a validation on sname field if value provided is not matching with old CDT.

How can I achieve this..

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    I assume that your post is around the validation, correct? What exactly do you mean with "not matching with old CDT"? Do you have any code you can share?

  • 0
    Certified Lead Developer

    Not much to go on but here you go:

    a!localVariables(
      local!cdt: {
        a!map(sno: 1, sname: "qef"),
        a!map(sno: 2, sname: "abc")
      },
      a!gridLayout(
        label: "Editable Grid",
        labelPosition: "ABOVE",
        headerCells: {
          a!gridLayoutHeaderCell(label: "Sno"),
          a!gridLayoutHeaderCell(label: "Sname")
        },
        columnConfigs: {},
        rows: a!forEach(
          items: local!cdt,
          expression: a!gridRowLayout(
            contents: {
              a!textField(
                value: fv!item.sno,
                saveInto: fv!item.sno,
                readOnly: true
              ),
              a!localVariables(
                local!value,
                a!textField(
                  value: local!value,
                  saveInto: local!value,
                  validations: if(
                    local!value <> fv!item.sname,
                    "Name doesn't match",
                    ""
                  )
                )
              )
            }
          )
        )
      )
    )