cancel
Showing results for 
Search instead for 
Did you mean: 

Filtering in Collection

KummariSrikanth
Level 4

Hi,

I want to filter the data in the collection by removing the spaces found in the collection data.

For example, I need to filter the name "ab c" or "a bc" by giving the filtering condition as "name ='abc'" 

First bot , should remove the spaces present in the input collection and then apply a filter. I need this kind of filtering if anyone knows please help me.

Thank You



------------------------------
Kummari Srikanth
------------------------------
1 BEST ANSWER

Helpful Answers

Hi Kummari Srikanth - You would just to need to tweak the code a bit - just add one more action - copy the same action and rename the action name and code stage name - Add one more input to determine the column where you want the space to be removed: 

1. Start Stage Input 1 as : Input Collection , Input 2 as : column Name End Stage Output: Output Collection as shown in below snip:

16196.png

2. Add Code Stage and Set Input and Output : Write Code -

Code:

For Each row As DataRow In Input_Collection.Rows
    row(column_name) = row(column_name).ToString().Replace(" ", "")
Next
Output_Collection = Input_Collection

16197.png

3. Check Code - Publish and Save Object and use it from Process to pass your collection and column name and return output collection.

Apply Filter Collection to get the result as you stated in your query above, let me know if you face any difficulties implementing this.

Have a good day, happy coding.



------------------------------
Kindly up vote this as "Best Answer" if it adds value or resolves your query in anyway possible, happy to help.

Regards,

Mukesh Kumar - Senior Automation Developer

NHS England, United Kingdom, GB
------------------------------
Regards,

Mukesh Kumar

View answer in original post

5 REPLIES 5

Mukeshh_k
MVP

Hi Kummari Srikanth, I would assume you have an extended object for Collection Manipulation - If not you can download one from Digital Exchange (https://digitalexchange.blueprism.com/dx/entry/3439/solution/utility---collection-manipulation)

1. Create a Custom Action in one of the Extended Collection Manipulation Object - Start Stage Input : Input Collection End Stage Output: Output Collection as shown in below snip:

16173.png

2. Add Code Stage and Set Input and Output : Write Code -

Code:

For Each Row as DataRow in Input_Collection.Rows
    For Each Col as DataColumn in Input_Collection.Columns
        row(col.ColumnName) = row(col.ColumnName).ToString().Replace(" ", "")
    Next
Next
Output_Collection = Input_Collection

16174.png

3. Check Code - Publish and Save Object and use it from Process to pass your collection and return output collection.

Apply Filter Collection to get the result as you stated in your query above, let me know if you face any difficulties implementing this.



------------------------------
Kindly up vote this as "Best Answer" if it adds value or resolves your query in anyway possible, happy to help.

Regards,

Mukesh Kumar - Senior Automation Developer

NHS England, United Kingdom, GB
------------------------------
Regards,

Mukesh Kumar

Hi Mukesh Kumar,

Thanks a lot for helping me in resolving this problem.I implemented the code it is working fine(Shared the results below).It is removing spaces for entire collection fields. But I need to remove spaces for one particular collection field. Please help me in resolving this issue of removing spaces for a particular column in collection.

16177.png
16178.png

Thanks & Regards,

Srikanth K



------------------------------
Kummari Srikanth
------------------------------

Hi Mukesh Kumar,

Thanks a lot for helping me in resolving this problem.I implemented the code it is working fine. It is removing spaces for entire collection fields. But I need to remove spaces for one particular collection field. Please help me in resolving this issue of removing spaces for a particular column in the collection.


Thanks & Regards,

Srikanth K


On Wed, 29 Mar 2023 at 19:16, Mukesh Kumar via Blue Prism Community <Mail@blueprism.email> wrote:
Hi Kummari Srikanth, I would assume you have an extended object for Collection Manipulation - If not you can download one from Digital Exchange ... -posted to the "Blue Prism RPA Product" community
16190.png

Blue Prism Product

Post New Message Online
Re: Filtering in Collection
Reply to Group Online Reply to Group
Mukesh Kumar
Mar 29, 2023 2:44 PM
Mukesh Kumar

Hi Kummari Srikanth, I would assume you have an extended object for Collection Manipulation - If not you can download one from Digital Exchange (digitalexchange.blueprism.com/dx/entry/3439/solution/...

1. Create a Custom Action in one of the Extended Collection Manipulation Object - Start Stage Input : Input Collection End Stage Output: Output Collection as shown in below snip:

16186.png

2. Add Code Stage and Set Input and Output : Write Code -

Code:

For Each Row as DataRow in Input_Collection.Rows
    For Each Col as DataColumn in Input_Collection.Columns
        row(col.ColumnName) = row(col.ColumnName).ToString().Replace(" ", "")
    Next
Next
Output_Collection = Input_Collection

16187.png

3. Check Code - Publish and Save Object and use it from Process to pass your collection and return output collection.

Apply Filter Collection to get the result as you stated in your query above, let me know if you face any difficulties implementing this.



------------------------------
Kindly up vote this as "Best Answer" if it adds value or resolves your query in anyway possible, happy to help.

Regards,

Mukesh Kumar - Senior Automation Developer

NHS England, United Kingdom, GB
------------------------------
  Reply to Group Online   Reply to Group via Email   View Thread   Recommend   Flag as Inappropriate  

Hi Kummari Srikanth - You would just to need to tweak the code a bit - just add one more action - copy the same action and rename the action name and code stage name - Add one more input to determine the column where you want the space to be removed: 

1. Start Stage Input 1 as : Input Collection , Input 2 as : column Name End Stage Output: Output Collection as shown in below snip:

16196.png

2. Add Code Stage and Set Input and Output : Write Code -

Code:

For Each row As DataRow In Input_Collection.Rows
    row(column_name) = row(column_name).ToString().Replace(" ", "")
Next
Output_Collection = Input_Collection

16197.png

3. Check Code - Publish and Save Object and use it from Process to pass your collection and column name and return output collection.

Apply Filter Collection to get the result as you stated in your query above, let me know if you face any difficulties implementing this.

Have a good day, happy coding.



------------------------------
Kindly up vote this as "Best Answer" if it adds value or resolves your query in anyway possible, happy to help.

Regards,

Mukesh Kumar - Senior Automation Developer

NHS England, United Kingdom, GB
------------------------------
Regards,

Mukesh Kumar

Hi Mukesh Kumar,

Thank You very much for resolving this problem.

16205.png
16206.png

 Thanks & regards,

Srikanth K



------------------------------
Kummari Srikanth
------------------------------