cancel
Showing results for 
Search instead for 
Did you mean: 

comparing collections

ps
Level 2

Hello I'm new to Blue prism, I want to compare two collection first one is coming from queue through get next item containing Roll No. And First Name and Second one is coming from Get Worksheet as collection containing Roll No and Last Name, Now I need to write last name back to queue if the Roll no is same for both collection and if not same then throw an exception, Anyone can suggest me how to do that?



------------------------------
p
------------------------------
3 REPLIES 3

sumire
Level 9

Hello @ps1 ,

I had the same problem and found this thread:

https://community.blueprism.com/communities/community-home/digestviewer/viewthread?MessageKey=614f644e-229d-4113-9a8d-dba63f6829b7&CommunityKey=3743dbaa-6766-4a4d-b7ed-9a98b6b1dd01&tab=digestviewer



------------------------------
Mitsuko
Asia/Tokyo
------------------------------
------------------------------
Mitsuko
Asia/Tokyo
------------------------------

PvD_SE
Level 12

Hi,

As you have the value for Role from the WorkQ and want to compare it against a collection derived from an XL, I'd do the following:

  • Filter the collection using the WorkQ Role value to see if that value exists and has the correct name
  • If it does: Write back to the WorkQ
  • If it does not: Exception

The filtering of a collection can be a tad tedious. I think there're some good youtube vid examples on the subject. There might even be something about it in the BP University. Alternatively, I'm quite sure there are a few coding examples for filtering on this community that you can use instead of the BP Filter Collection action.



------------------------------
Happy coding!
---------------
Paul
Sweden
------------------------------
Happy coding!
Paul, Sweden
(By all means, do not mark this as the best answer!)

Hi, p s,

see attached the custom action which does inner join. As collections are like datatables you can perform sql task on them. This action takes following parameters - Input Collection1, Field1, Input Collection 2, Field2. Field1 will be Roll No and Field2 will be also Roll No (be careful about syntax). You should get output which is the combination of both input collections fields if there is a match on Field1 and Field2.

I forgot to mention that you will need references to certain dll files:

System.Xml.Linq.dll

System.Data.DataSetExtensions.dll

If you do not know where to put it let me know.

Hope this helps.

Regards

Zdenek



------------------------------
Zdeněk Kabátek
Head of Professional Services
NEOOPS
http://www.neoops.com/
Europe/Prague
------------------------------