Skip to main content
January 10, 2022
Solved

How to delete duplicate values in a list or set?

  • January 10, 2022
  • 5 replies
  • 0 views

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?

    Best answer by stewart.burchell

    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
    January 10, 2022

    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.

    January 10, 2022

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

    stewart.burchell
    January 10, 2022

    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.