how to create data column at a specific location dynamically
like without mentioning the column index can we mention like beside this column like that?
use invoke code activity to create a column dynamically
dt1.Columns.Add("ColumnName").SetOrdinal(3)
You can pass any index where you want to add the column
but the columnindex you are giving should not exceed the columns count
You cannot mentioned beside a specific column…but what you can do is get the column index ousing column name and then add 1 to it and create a column using that index
To get index of a column use assign with
Requiredindex = (From dc In dt.Columns.Cast(Of DataColumn) Select dc.ColumnName).ToArray().indexOf("RequiredColumnName")
Here requiredindex is integer type and add 1 to it to get the next column index where new column needs to be added
Cheers
Try like this
Requiredindex = Array.IndexOf((From dc In dt.Columns.Cast(Of DataColumn) Select dc.ColumnName).ToArray(),"RequiredColumnName")
Cheers
What is this .reqindex …you just need to specify the requndex +1
And pass the datatable to invoke method…please check here
Cheers

I have added the material description column but its over writing the data
my input data is first empty column then vala,material,totals,bun,totalv,crcy
i added material description column beside of material but the material description column didnt came empty
check this flow once.
can you check this once
Create two variables
existingColumnName As String = “YourExistingColumnName”
newColumnName As String = “YourNewColumnName”
'Find the index of the existing column
columnIndex As Int32 = dtTable.Columns.IndexOf(existingColumnName)
Create the variable newColumn
newColumn As New DataColumn(newColumnName)
Add the new DataColumn to the DataTable
dtTable.Columns.Add(newColumn)
Use SetOrdinal to place the new column beside the existing column
This will move the new column to the position right after the existing column
If columnIndex <> -1
Then
newColumn.SetOrdinal(columnIndex + 1)


