29-03-23 01:45 PM
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
Answered! Go to Answer.
29-03-23 05:46 PM
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:
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
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.
29-03-23 02:44 PM
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:
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
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.
29-03-23 03:27 PM
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.
Thanks & Regards,
Srikanth K
29-03-23 03:33 PM
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
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
Blue Prism Product
Post New Message Online
Re: Filtering in Collection
Reply to Group Online Reply to Group
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:
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
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
29-03-23 05:46 PM
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:
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
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.
30-03-23 07:32 AM
Hi Mukesh Kumar,
Thank You very much for resolving this problem.
Thanks & regards,
Srikanth K