cancel
Showing results for 
Search instead for 
Did you mean: 

Delete null columns

Karan_
Level 2
Is there any vbo to delete empty columns as we have for rows, or if there is any code to use?
4 REPLIES 4

John__Carter
Staff
Staff
Yes the Utility - Collection Manipulation VBO

Karan_
Level 2
Thanks John, but there I could find only for rows. I am looking for something to delete empty columns.

BellaKoh
Level 3
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.

AndreyKudinov
Level 10
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