Check below screenshot for example , you can refer for how it will look alike but for logic I have explained below.
Inside loop once you filtered using the condition, you need to check whether filtered list is empty or having some object to do that add condition like this
Consider your filetered list variable name is filteredList then
$filteredList!=empty – if this is true then add it to your payments_obj list if not continue with next invoice in loop
Ok so what I understand you have 2 lists? An invoice list and a payments list and you want to compare the values of documentnr vs invoicenr?
What I would do is iterate over the invoice list with a loop. Within that loop you can add a filter/find operation. With this operation you can compare the value of the iterator versus an attribute of that list.
The result is either 1 object or a list of objects, depending on if you use the filter or find.
Hope this helps!
It looks like you’ve got an association between the two entities in your previous post? The easiest way in that case is to use a retrieve action on Invoices with XPath something along the lines of the image below. This retrieves all invoices where there’s an associated payment. Is there a reason you need to use an Execute Query?
Inside your loop,
filter the ListofInvoicePayments list using invoice number. Use filter by expression to filter the list inside loop.
Expression will be : $CurrentObject/InvoiceNumber = $IteratorInvoice/DocumentNumber.
The above condition will give you the list of invoice payment if exists.
After this filter by expression, u can use decision to check whether the filtered list is empty or not