Validation on editable grid

i want to highlight these two duplicate values when a user enter a duplicate value.

Please suggest me validation code.

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    a!localVariables(
      local!data: {
        a!map(key:1, value:"A"),
        a!map(key:2, value:"B"),
        a!map(key:3, value:"A"),
      },
      a!gridLayout(
        headerCells: {
          a!gridLayoutHeaderCell(label: "Header Cell")
        },
        rows: a!forEach(
          items: local!data,
          expression: a!gridRowLayout(
            id: fv!index,
            contents: {
              a!textField(
                value: fv!item.value,
                saveInto: fv!item.value,
                validations: if(
                  contains(
                    remove(local!data.value, fv!index),
                    fv!item.value
                  ),
                  "Duplicate",
                  null
                )
              )
            }
          )
        ),
      )
    )