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
  • Hi Abhay,

    Thanks for that. It works. But there are still some issues with that.

    Like:
    If you edit the existing duplicate textbox instead of deleting that row then it will still throw an error because when you edit the existing textbox then another entry is appended in the ri!role input instead of replacing the existing index value.

    Regards,
    Mohit
  • Hi Mohit,

    for this error , what you can do instead of saving , you just replace the value based on Index for the existing record then i think your concern will be resolved , and still you receive error please let me know , i will share the code as well with you.

    Regards
    Abhay Giri
    Mark this reply as answered or vote if this helps you.
Reply Children