Skip to main content
May 19, 2022
Question

need validation to avoid picking same user multiple times when we trying to add a row in editable grid

  • May 19, 2022
  • 4 replies
  • 0 views

need validation to avoid picking same user multiple times  when we trying to add a row in editable grid

4 replies

stefanhelzle0001
Brainy
May 19, 2022

OK. What did you try so far?

One option could be to compare the number of items it the assignees list to the number of items in the union of the assignees list. in pseudo-code, this could look like this.

count(assignees) = count(union(assignees, assignees))

May 19, 2022

This does not prevent duplicates, but only limits the amount of chosen options to the amount of unique available options.

I suggest a validation for each chosen value that checks for multi-presence in the list of chosen values, using the count on wherecointains(). Note: depending on the implementation, this approach can be heavy for large volumes.

May 19, 2022

is there any alternative method....? can't we make it using union function...?