28-04-21 09:10 PM
29-04-21 12:43 AM
Hello Lorenzo
If you are trying to compare each value of one collection with each value in the other collection then you can try the following logic i.e. loop within a loop
Using this you can compare values in both the collections
29-04-21 06:48 AM
29-04-21 06:57 AM
Yup, comparing two collections can be a pain. Welcome to BP! 🙂
You could try action Intersection Between Collections that returns the common values between two collections. I haven't used this one, so give it a try. I assume you have to validate the results in some way. Read the help text first, although it holds the same (very low) quality of most of the help texts in BP.
(BP folks: How can it be so hard to write help text for a product? It's not like it is freeware!)
If you only need to establish if they are different, you could start with a row count and columns count on the two collections (Count Rows and Count Columns) and compare if they differ. If there's an amount or other numerical fields, you can total them (Get Field Sum Total) to see if they are equal. Also, you can extract the fields of the two collections (Get Collection Fields) and compare that they have the same fields. If any of this results in a difference, you know they are now identical.
A row-by-row could can be more of a challenge though. I'd sort the collections on the same criteria, then read one collection and the same row for the other, and then compare the two. This will be somewhat of a challenge too I'm afraid.
Comparing rows between the two collections can be done in a Decision stage as:
[CollA.Field1] = [CollB.Field1]
AND
[CollA.Field2] = [CollB.Field2]
AND
[CollA.Field3] = [CollB.Field3]
AND...
Or in a more speedy fashion by concatenating each all fields on each row you've read and compare the results between the two:
[CollA.Field1] & [CollA.Field2] & [CollA.Field3]... = [CollB.Field1] & [CollB.Field2] & [CollB.Field3]...
I assume that one of the supported languages for the Code stage such as C# might provide a simpler solution.
----------------
Happy coding!
Paul
Sweden
29-04-21 12:31 PM
29-04-21 01:19 PM