Hello,
I would like to ask if there is any function that can remove Duplicates from multiple variable
For example:
20
30
10
The result of this should be:
In this case union will not work for me because I don't have another array to which I cam compare.
Discussion posts and replies are publicly visible
You can either union it to itself or just union it to an empty array. The one tricky thing is that you have to ensure the data types are the same, so you may need to cast to the correct type. Here's an example with union-ing to an empty array:
a!localVariables( local!values: {20, 20, 30, 30, 30, 10}, union( tointeger(local!values), tointeger({}) ) )
Example: union(tostring({"a", "b", "a"}), tostring({})) I need to return a, b now it returns Value a; b; a;
Use touniformstring
union(touniformstring({"a", "b", "a"}), tostring({}))
union(touniformstring({"a", "b", "a"}), tostring({})) will return {"a","b"," "} in the output.
rdrop(union({"a", "b", "a"}, tostring({})),1) can be used instead for a list of text.
In case of list of integers ,as mentioned by Peter Lewis ,
union({20,20,30,30,30,10}, tointeger({})) would do the job!!
You can also use touniformstring for both instead of tostring() and dropping the last one:
union( touniformstring({"a", "b", "a"}), touniformstring({}) )