In a Logic App I am developing I would like to have the objects in array A from which no entity in array B exists. The arrays have the following structure:
Array A
[{"ExternalId": 1}, {"ExternalId": 2}]
Array B
[{"Id": 2}]
Besides the id's these arrays contain a lot more properties which I will leave away for simplicity.
The result I want is to have the array A filterd based on ExternalId's which are not available in Array B so this should result in the following filtered array:
[{"ExternalId": 1}]
I tried to use the FilterArray action for this but I don't know how to model this. According to the Workflow Definition Language there is a @contains function but I am not able to contruct it in the correct way.
Is it possible to do this in this way? Is there another way to achieve this result in Azure Logic Apps?
Yeah I don't think this would be possible just yet - the only way you could get it would be as follows, but may be easier to just run inside an Azure Function for now.
{ "body": "@item()['ExternalId']" }
Outside the foreach loop you could do @body('Compose') now and you'd have an array of ExternalId Values ( [ 1 ]
in this case above ).
Now create the filter array on Array A, and the filter condition is where @contains(body('Compose'), item())
In the future we plan to support @select() @where() @orderby() type constructs that would make this easier, as well as a map-array action - but still in design. For now you could choose approach above or call an Azure function to do with javascript/C#
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With