Skip to main content
Inspiring
Jan 10, 2022 9:29 AM UTC
Solved

How to delete duplicate values in a list or set?

In java or python i can use for loops to check it underscore i such as

for(i:0;i<100;i++){

  for(j:i+1;j<100,j++){

if list[i]=list[j]

list[i]="common value"

}

}

if arraylist contains["common value"]{

arraylist.remove["common value"]

}

for java a!forEach, i can't find its underscore i, i don't know which way can express it fv!index like this way in the parenthesis? how to do it?

    stewart.burchell
    Employee
    Jan 10, 2022 9:43 AM UTC

    Appian provides set functions to deal with lists/arrays. One of these is fn!union(). If you union an array with itself then this will automatically remove duplicates.

    5 replies

    stewart.burchell
    Employee
    Jan 10, 2022 9:43 AM UTC

    Appian provides set functions to deal with lists/arrays. One of these is fn!union(). If you union an array with itself then this will automatically remove duplicates.

    Inspiring
    Jan 10, 2022 9:48 AM UTC

    may i now how to not it delete duplicate values like sql union all?

    stewart.burchell
    Employee
    Jan 10, 2022 9:53 AM UTC

    You can try these things out for yourself (I always do to satisfy myself that I fully understand how a give function behaves). Here's the small test I made for myself:

    As you can see the fn!union() removes duplicate values but always keeps a single instance of any value present in the original array.