cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop "Filter Collection" from sorting the result by default.

MeghalVasa
Level 3
I have a collection with one column data as below: (Collection In = Lines) |------------------------------------------| Field Name = Line (Text) Name                Microsoft OneDrive for Business Publisher           Microsoft Corporation Status              New Name                McAfee Endpoint Security Web Control Publisher           McAfee, Inc. Status              Enabled Name                Send to OneNote Publisher           Not Available Status              Disabled |------------------------------------------| Now I want to convert this to a (Name|Status) collection, so I first filter the collection by Name & then by Status & then merge the 2 collections to obtain something like below: (This works fine except the entries misalign as they get sorted alphabetically by default within "Filter Collection" stage which is not desired) |-----------------------------------|-------| Name (Text) | Status Text) Microsoft OneDrive for Business  | New McAfee Endpoint Security Web Control | Enabled Send to OneNote | Disabled |-----------------------------------|-------| The Collection manipulation -> Filter Collection stage is giving in snapshot has Collection In as "Lines" above & the Filter is given as "[Line] LIKE '%Name%'" The inbuilt VBO "Filter collection" is by default given the filtered output in a new Collection in a sorted order like below |------------------------------------------| Line (Text) McAfee Endpoint Security Web Control Microsoft OneDrive for Business  Send to OneNote |------------------------------------------| but I need it in the order of Collection In as it is... Unsorted. How do I do it? Why is the "Collection Manipulation" -> "Filter Collection"  VBO Sorting the filtered result alphabetically by default when there is already another action of "Sort Collection" already present in same VBO? Please tell me how to change the default behavior of this VBO to not sort the Output Collection. What changes I can do or which is easiest way to fix this.  
5 REPLIES 5

Mustafa_UlasYig
Level 6
Hi Meghal I hope I understood all of the above text correct. I tried to come up with a solution for your problem, not the most elegant, but it works. I am sure this can be solved way faster with code or perhaps a smarter way of combining standard functionality provided by BP VBO's. Please see enclosed process. Let me know if you have any questions. Good luck. BR, Mustafa

MeghalVasa
Level 3
Hi Mustafa, That was really quick reply & that too with a fully working solution workflow. Though the ""|"" character was just supposed to be a representation of the separator line between the fields of collection the overall solution is pretty close to what I desired. (except for outcome expected to be a two column collection without any ""|"" instead of one column with ""|"" separator. I can manage the rest of manipulations myself. Yes, I agree, the solution is slow & not very elegant compared to the built in VBOs but it works well. So a big ""Thank You"" for helping me. I got many useful tips from your workflow like how to convert the Collection to CSV text & how to add new line feeds... etc. which would be helpful in future at a low level data formatting. I am still annoyed by the fact that the ""Filter Collection"" VBO does not have any control parameter to avoid default sorting... I am expecting something like [Sort-(Flag)-True / False] at the least to be added as an input parameter for this VBO. It would be great if someone from Blue Prism could help me tweak the VBO code to add this functionality. I have another issue which I am sure you could quick suggest how to resolve. I am trying to save the collection to my reporting Excel Sheet & below get error for ""excel vbo->write collection"" ""Internal : Could not execute code stage because exception thrown by code stage: The given key was not present in the dictionary."" I have attached the snapshot for the stage which gives this error. My workflow has below stages: 1) Create Instance  2) Open Workbook 3) Write Collection (Which gives error) 4) Save & Close Excel Please suggest how to resolve this error. Thanks in advance. 

MeghalVasa
Level 3
Hi Mustafa, I figured out the issue. PI was working with wrong ""excel vbo"" instead of working with ""MS Excel VBO"". Issue is resolved after using correct VBO.  Thanks, Meghal.

Mustafa_UlasYig
Level 6
Hi Meghal Glad it worked out. And, of course there are way easier ways of doing this, please see enclosed file to a more simple solution. But yeah, there is probably a way to code something more elegant and generic, that can filter results without sorting the results. Have a nice day. BR, Mustafa

could i also get this solution? Im new to this and im suffering the same problems. Thanks already!

------------------------------
Oscar Arnold
------------------------------