cancel
Showing results for 
Search instead for 
Did you mean: 

Compare 2 collection and check if values match

LorenzoCapocci1
Level 5
Hi,
I hope all is well...
I am processing a simple comparison of 2 collections, and merging the result into 1, but I have a problem with empty rows...
basically I would like to keep the empty row if a value is not found in the 2nd column, but I am not able to find a solution... seems simple but for some reason i am unable to apply it
Below I provide the example of 2 screen shot as the current report result and the wanted result....

Are you able to provide an example and provide directions?
thank you very much


36685.png


Current result

36686.png
Wanted result

36687.png
1 BEST ANSWER

Best Answers

Thanks for clarifying the doubt. I have attached the sample solution flow below:

36679.png

As you can see in the flow, first I looped within the SDPI collection which had the values as below:


36680.png
The Cognos collection has the below values:

36681.png

Within the loop the following actions will take place:

- First, I added a row to a defined collection called as "Final Collection" with the fields: SDPI_MATERIAL_ID (text), COGNOS_MATERIAL_ID (text) and Match? (text)
- Next, I used the 'Collection Contains Value' action to check if the current material id column value for SDPI collection exists in the Cognos collection to return me a flag value called 'Matched'.
- If the value of 'Matched' is True, I will set SDPI_MATERIAL_ID and COGNOS_MATERIAL_ID as the current value of MATERIAL_ID column of SDPI Collection and Match? value as "Yes" otherwise if the value value of 'Matched' is False, I will set SDPI_MATERIAL_ID as the current value of MATERIAL_ID column of SDPI Collection, COGNOS_MATERIAL_ID as blank and Match? value as "No" 

Post running the solution, the final collection has the following values:

36682.png

Hope the above solution explanation helps you out 🙂

----------------------------------
Hope it helps you out and if my solution resolves your query, then please provide a big thumbs up so that the others members in the community having similar problem statement can track the answer easily in future.

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Technical Business Analyst,
WonderBotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------

View answer in original post

5 REPLIES 5

Hi Lorenzo,

If I correctly understand, you are validate that the values for material ID present in SDPI collection also exist in COGNOS collection. If they are available then you need to write both the material ID's and also put the match column value as "Yes" and if they are not available you need to only write the SDPI material value, leaving COGNOS value with Match column value as "No". Your wanted collection in that case should be something like this:

36678.png
From the screenshot that you have provided only for first two rows the match value is "Yes" and for the rest of the rows it is "No" even though the material ID's: GI3445304, GI3445404 and GI3445604 exists in both Material_ID_SDPI and Material_ID_Cognos.

Can you once confirm if my understanding is correct or is there some logic that I am missing to identify these match values?
----------------------------------
Hope it helps you out and if my solution resolves your query, then please provide a big thumbs up so that the others members in the community having similar problem statement can track the answer easily in future.

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Technical Business Analyst,
WonderBotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------

LorenzoCapocci1
Level 5
Hi @devneetmohanty07 ,
ye you are correct, ​I thought I had this working but I was wrong... basically if the value is not found in the 2nd column, it should just leave a blank cell
thank you

Thanks for clarifying the doubt. I have attached the sample solution flow below:

36679.png

As you can see in the flow, first I looped within the SDPI collection which had the values as below:


36680.png
The Cognos collection has the below values:

36681.png

Within the loop the following actions will take place:

- First, I added a row to a defined collection called as "Final Collection" with the fields: SDPI_MATERIAL_ID (text), COGNOS_MATERIAL_ID (text) and Match? (text)
- Next, I used the 'Collection Contains Value' action to check if the current material id column value for SDPI collection exists in the Cognos collection to return me a flag value called 'Matched'.
- If the value of 'Matched' is True, I will set SDPI_MATERIAL_ID and COGNOS_MATERIAL_ID as the current value of MATERIAL_ID column of SDPI Collection and Match? value as "Yes" otherwise if the value value of 'Matched' is False, I will set SDPI_MATERIAL_ID as the current value of MATERIAL_ID column of SDPI Collection, COGNOS_MATERIAL_ID as blank and Match? value as "No" 

Post running the solution, the final collection has the following values:

36682.png

Hope the above solution explanation helps you out 🙂

----------------------------------
Hope it helps you out and if my solution resolves your query, then please provide a big thumbs up so that the others members in the community having similar problem statement can track the answer easily in future.

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Technical Business Analyst,
WonderBotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------

LorenzoCapocci1
Level 5
Hi @devneetmohanty07​Thank you once again, but Forgive me, can you show me how you updated the 'Collection Contains Value' action  please? sorry
I am having a bad day today.

No issues at all @LorenzoCapocci1, my bad I forgot to attach this one screenshot. Please find the below parameters for the action stage:

36683.png
36684.png
​​​
----------------------------------
Hope it helps you out and if my solution resolves your query, then please provide a big thumbs up so that the others members in the community having similar problem statement can track the answer easily in future.

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Technical Business Analyst,
WonderBotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------