Hi I’m new here,
I have one question regarding UiPath DataTable.
In UiPath, I want to add a new column to an existing DataTable without using the “Add Data Column” activity.
Can anyone help me with the proper solution?
Thanks
Hi I’m new here,
I have one question regarding UiPath DataTable.
In UiPath, I want to add a new column to an existing DataTable without using the “Add Data Column” activity.
Can anyone help me with the proper solution?
Thanks
Hi,
You can try this:
Use an Assign activity.
NewColumn → yourdatatblename.Columns.Add(“NewColumnName”, GetType(String))
Variable type: NewColumn → System.Data.DataTable
Thanks
Ok, I’ll try this
Thanks
Hi @Ss_RPA
Welcome to the Community
Try this
Make sure your DataTable is already created
Example name: dtData
Drag and drop assign activity
Pass this dtData.Columns.Add(“NewColumn”, GetType(String))
If you want give the new colume value for all rows then use for each row
CurrentRow(“NewColumn”) = “Done”
Continue with next steps
Please let me know if you still face the issue and if solution works for you please mark as solved
Thanks & Happy Automations
Hi @Ss_RPA ,
You can add a column directly using an Assign activity with this line:
dt.Columns.Add(“NewColumnName”, GetType(String))
This adds a new column to the existing DataTable without using the Add Data Column activity.
Any reason for not using the Add Data Column activity?
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.