Duplicate check in a dynamic grid layout

Hi, I have a text field in dynamic grid layout. How do i check for a duplicate entry and generate a error message in validation?

(I'm storing the entries from the text field in a rule input of cdt type)

  Discussion posts and replies are publicly visible

Parents
  • Hi Mohit,

    If i am right here, then you are adding a new row then you want to do duplicate check,right? if yes then create a rule input array type and save each value of that text field so if you added three new row then this variable will hold three different values(till now i added different values in text field). Now use the below code for validation:

    in the saveInto use the below code:

    a!save(
    ri!roles,
    append(
    ri!roles,
    fv!item.roleName
    )
    )
    and for validation use below :

    if(
    count(
    index(
    ri!roles,(your variable name where you need to store each value)
    wherecontains(
    fv!item.roleName, (your text field value)
    ri!roles
    ),
    0
    )
    ) >= 2,
    "Please select different Value",
    ""
    )



    Regards
    Abhay
Reply
  • Hi Mohit,

    If i am right here, then you are adding a new row then you want to do duplicate check,right? if yes then create a rule input array type and save each value of that text field so if you added three new row then this variable will hold three different values(till now i added different values in text field). Now use the below code for validation:

    in the saveInto use the below code:

    a!save(
    ri!roles,
    append(
    ri!roles,
    fv!item.roleName
    )
    )
    and for validation use below :

    if(
    count(
    index(
    ri!roles,(your variable name where you need to store each value)
    wherecontains(
    fv!item.roleName, (your text field value)
    ri!roles
    ),
    0
    )
    ) >= 2,
    "Please select different Value",
    ""
    )



    Regards
    Abhay
Children