Checking for duplicates in an array or list

Certified Senior Developer

Hi

I want to check for duplicates in Supplier list when I am adding a new supplier. 

I tried using this expresssion:

 

a!textField(
                label: "Supplier Name",
                value: fv!item.description,
                saveInto: fv!item.description,
                validations:
                {
                  if(
                    count(wherecontains(local!suppliers,index(fv!item,fv!index,{})))>1,
                    "Supplier already exists",{}
)
},

But I am getting the error -> Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!forEach [line 39]: Error in a!forEach() expression during iteration 1: Expression evaluation error at function 'wherecontains' [line 52]: Invalid types, can only act on data of the same type (Any Type, Text)

I tried the methods mentioned in earlier posts but not able to fix it yet. Can someone help me?

Thanks

  Discussion posts and replies are publicly visible