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

Meghal Vasa

New Member
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.
 

Attachments

  • Filter Collection.PNG
    25.3 KB · Views: 41

VJR

Well-Known Member
Hi Meghal Vasa,

I've checked the code for the Filter collection and it did not directly contain anything that sorts the data. However it adds a new row based on the match criteria and then adds data to that row which might then be sorting the rows as its default behaviour.
All I can suggest you is to have a new column (say SrNo) in the collection which would contain numbers from 1 to the last row count. After a Filter is applied for the 'Name' then use the 'Sort collection' action to sort the data by SrNo. Do the same to the other collection for the 'Status'. Now when both the collections are in the same order as the original then the Merge collection would give the correct output. There could be other ways too but this is just one of them.
 

Meghal Vasa

New Member
Hi VJR,

Many thanks for your reply. I too had checked the code & found a dead end there. I have now done a cell by cell filter based on the same criteria & filled another collection if the filter criteria matches cell by cell as a workaround. This solution is very slow & not efficient & it seems your suggestion is more faster in terms of execution time. I like your genius idea of adding a serial number column & still using the same filter collection VBO.
Appreciate you for sharing this smart idea.

Regards,
Meghal.
 

VJR

Well-Known Member
Hi VJR,

Many thanks for your reply. I too had checked the code & found a dead end there. I have now done a cell by cell filter based on the same criteria & filled another collection if the filter criteria matches cell by cell as a workaround. This solution is very slow & not efficient & it seems your suggestion is more faster in terms of execution time. I like your genius idea of adding a serial number column & still using the same filter collection VBO.
Appreciate you for sharing this smart idea.

Regards,
Meghal.
Hi Meghal,

Cheers. I've tried out a few things while responding to you. So do post back if you are facing any issues in implementing this approach.
Also, maybe you are already doing it, but the diagram can be made efficient by getting the Name, Status and incrementing the SrNo counter all in one single loop.
 
Top