i have dynamic array, meaning the value and length depends on my REST API call result.
i need to make that array has unique or distinct value, meaning the value inside the array must be unique to each other.
ANy idea?
Thanks
i have dynamic array, meaning the value and length depends on my REST API call result.
i need to make that array has unique or distinct value, meaning the value inside the array must be unique to each other.
ANy idea?
Thanks
The linked comment using union shows how but does a bit more than the original request so those that want the very simple answer to the question - how do I get the unique/distinct values from an array - all you do is union the array with itself, i.e.
and the expression in the 2nd initialise just does:
union(variables('TestArray'),variables('TestArray'))
The ideal way to do this be passing exactly the data that you need into the logic app, and not require the logic app to do further processing on the area.
Suggestion 1: Feed the response from your function into another function that will return only the distinct values. Continue processing with your logic app without having the need to iterate through the entire array
Suggestion 2: Create an array variable. Iterate through your array with duplicates using the Foreach action. For each item() in the array that does not exist in your new array, add it.
Also, look at this answer regarding the union function.