Skip to main content
September 11, 2023
Question

Paging grid validations

  • September 11, 2023
  • 2 replies
  • 0 views

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..

    2 replies

    stefanhelzle0001
    Brainy
    September 11, 2023

    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?

    mathieud0001
    September 11, 2023

    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",
                    ""
                  )
                )
              )
            }
          )
        )
      )
    )