Delete null columns
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
24-07-18 07:44 PM
Is there any vbo to delete empty columns as we have for rows, or if there is any code to use?
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
24-07-18 10:14 PM
Yes the Utility - Collection Manipulation VBO
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
24-07-18 11:49 PM
Thanks John, but there I could find only for rows. I am looking for something to delete empty columns.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
27-07-18 03:42 PM
Hi Karan,
I don't think BluePrism has any standard objects for deleting empty columns. You would either have to write a code for this, or use an alternative method to do so.
For the alternative method, you can try the following:
Let's say you want to remove empty columns from Collection A.
First, use 'Get Collection Fields' on Collection A. The list of column names will be output into Collection B.
Loop through Collection B column names.
For each column, filter Collection A by non-blank values, into Collection C. You can input ""[""&[Collection B.Field Name]&""]''"" into the filter input (i.e. [Column Name]'').
Count the number of rows in the filtered Collection C.
If count > 0, don't delete the column. If count = 0, delete the column.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
30-07-18 02:08 PM
I use this code to remove null columns:
Dim Changed As Boolean = False
Do
Changed = False
For Each Column As DataColumn In Input_Collection.Columns
Dim removeColumn as Boolean = True
For Each row As DataRow In Input_Collection.Rows
If (Not (row(Column) = """")) Then
removeColumn = False
Exit For
End IF
Next
If (removeColumn) Then
Input_Collection.Columns.Remove(Column)
Changed = True
Exit For
End If
Next
Loop while Changed = True
Output_Collection = Input_Collection
