cancel
Showing results for 
Search instead for 
Did you mean: 

Collection Bug

NiklasFranke
Level 5

Hello Together,

i have an Excelfile where i cant save the header because the columns have sometimes the same name so i want to insert the data into a collection and insert the new collection into the File.

However, when i add an entry like "Company2" f.e. in the middle and press okay, the collection puts it at the end and i cant prevent that. The Field cant be at the end because inserting the collection would put the Value in the wrong column then. 

 

image.png



5 REPLIES 5

ldickin
MVP

Hi @NiklasFranke ,

My experience with collections has always been that new fields added go to the end.  One way you might be able to get around it is maintain a reference collection in your process that contains the fields in the correct order (including your new Company2 field) and then you can use a multi-calc to map the fields from your original collection to the new collection.  

Hi,

use this code to move a field in a specific position:

 

success = false
errorMessage = ""
 
For Each column As DataColumn in dtIN.Columns
 
If columnIN = column.ColumnName()
 
success = true
Exit For
 
End If
 
Next
 
If success = true
 
dtOUT = dtIN.Copy()
dtOUT.Columns(columnIN).SetOrdinal(Position - 1)
 
Else 
 
errorMessage = "ColumnIN does not exist in dtIN"
 
End If
 
Simone

naveed_raza
Level 9

if you want to add any new column at any where between your existing columns then , where you want to add new column , from there rest all columns should be move to down , then only it will stay at that position.

if you add new new column by clicking on add button between any column , then automatically it goes to end only.

that is the default behavior of collection , but again if Blueprism  team can updates this utility then would be good 

arpit12345678
Level 3

Hello @NiklasFranke 

Which BP version are you using?

NiklasFranke
Level 5

Hello all and sorry for the late reply. We are using 7.3.2. 
Imagine adding a new Row to an Excelsheet and the file puts it at the end and you have to move every Row down.. Holy, i hope that they will fix that.