Replace a character
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
19-01-20 05:06 PM
I want to replace the spaces with string "_" in multiple rows of a collection. Blue Prism allows to do so with replace function for first row only. How can it be done for multiple rows?
Thanks
------------------------------
shah s
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
20-01-20 02:20 AM
Hello, shah s
You can use loop stage to loop through all the rows in the collection.
Since you have successfully replace the character in one row of the collection, you should be able to achieve what you were trying to do with adding a loop.
Regards,
Met Vonghiran
------------------------------
Met Vonghiran
Consultant
Deloitte
Asia/Tokyo
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
20-01-20 07:57 PM
------------------------------
shah s
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
20-01-20 08:12 PM
A Collection does store rows of data, just like rows in an Access Database table, or even rows in an Excel Worksheet.
The Loop stage loops through the Collection rows 1 by 1 allowing you to use a Calculation stage to update the value of the row column.
The Replace function in a Calculation stage will provide the function you need.
There are other ways to achieve this if working with large Collections, but that's more advanced so use the Loop stage.
------------------------------
Carl Carter
Developer Program Manager
Blue Prism
Europe/London
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
21-01-20 08:27 PM
------------------------------
shah s
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
23-01-20 05:23 AM
Make 3 Inputs:
Blanks- Collection name
TBR: The value to be replaced (_)
Value: The value which you want to replace by ("ABC")
try for each dr as datarow in blanks.rows for each c as datacolumn in blanks.columns if (dr(c.columnname)).ToLower() = (TBR).ToLower() then dr(c.columnname) = Value end if next next no_blanks = blanks catch e as exception end try
------------------------------
Vivek Goel
RPA Architect
Asia/Singapore
"If you like this post, please press the "Recommend" Button.
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
23-01-20 09:00 AM
I believe Shah is looking to replace all occurrences of the space char, and whilst some small changes to your code would achieve this, it is also possible through standard Blue Prism stages and the 'Utility - Collection Manipulation' Business Object.
I've provided an example of how to achieve this without using custom code:
Process xml attached.
Hope this helps.
------------------------------
Carl Carter
Developer Program Manager
Blue Prism
Europe/London
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
04-02-20 04:49 AM
I have gone through code and found an issue that code is removing spaces in password fields also. Kindly check the below code which handled the bug through code stage.
Collection_Out=Collection_In.Copy for each dr as Datarow in Collection_Out.Rows for each dc as DataColumn in Collection_In.Columns If( GetBluePrismDataType(dc.datatype)="text" ) If(dr(dc.columnname).Contains(" ")) then dr(dc.columnname)=Replace(dr(dc.columnname)," ","_") end If End If Next Next
------------------------------
Ravi Teja
RPA Developer
Accenture
Asia/Kolkata
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
05-02-20 01:14 PM
I wouldn't expect a password field to contain spaces, however a simple decision stage added to the solution I provided could prevent a password field being updated. You can use the column name of the password column(s) in the decision stage, and ignore updating these columns.
------------------------------
Carl Carter
Developer Program Manager
Blue Prism
Europe/London
------------------------------
