Trim all field values in a single row collection
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
16-10-19 11:26 AM
Hi Everyone.
Can anyone help me with trimming all field values in a single row collection. I am reading all information on a page into different columns of a collection.
I tried Transpose collection and then delete space action in a loop. But didnt find any way to reverse transpose back to original collection.
The only way I found was to use multi-calculation after at end to trim each value. But I have lot of elements (70+) and wish I could do this lot quicker.
Any suggestion?
Thanks & regards,
Vishvesh
------------------------------
Vishvesh Kadam
Automation Builder
Permanent TSB
------------------------------
Can anyone help me with trimming all field values in a single row collection. I am reading all information on a page into different columns of a collection.
I tried Transpose collection and then delete space action in a loop. But didnt find any way to reverse transpose back to original collection.
The only way I found was to use multi-calculation after at end to trim each value. But I have lot of elements (70+) and wish I could do this lot quicker.
Any suggestion?
Thanks & regards,
Vishvesh
------------------------------
Vishvesh Kadam
Automation Builder
Permanent TSB
------------------------------
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
16-10-19 05:07 PM
Something like this in C# code stage for any number of columns/rows, needs System.Data.DataSetExtensions.dll reference:
foreach (DataColumn column in inCollection.Columns){ if (column.DataType == typeof(string)) { for (int i = 0; i < inCollection.Rows.Count;i++) { inCollection.Rows[i][column.ColumnName] = inCollection.Rows[i].Field<string>(column.ColumnName).Trim(); } } } outCollection = inCollection;
p.s. You might need to additionally check for DBNull if inCollection comes from some other code in the same code block (database query for example), but Blueprism collections should not ever have DBNulls in them and this should not be a concern here.
------------------------------
Andrey Kudinov
Project Manager
MobileTelesystems PJSC
Europe/Moscow
------------------------------
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
17-10-19 10:29 AM
Thanks a lot Andrey Sir.
It worked perfectly as i wished for.
Cheers,
Vishvesh
------------------------------
Vishvesh Kadam
Automation Builder
Permanent TSB
------------------------------
It worked perfectly as i wished for.
Cheers,
Vishvesh
------------------------------
Vishvesh Kadam
Automation Builder
Permanent TSB
------------------------------
