Has anybody ever used 'Column' as input property in the AddDataColumn activity?

Has anybody ever used ‘Column’ as input property in the AddDataColumn activity?
I do not seem to find any way of creating a ‘Datacolumn object’ (not adding Datacolumn in a Datatable), in order to be able to use the resulting ‘DataColumn object’ as the input property in the AddDataColumn activity.

Could you please provide a sample workflow file if you were able to do it?

1 Like

Hi @Athrix05,

Refer the sample workflow with sample excel file which explains how to use column property of add data column activity

Data (1).xlsx (34.2 KB)

The sample excel file has few columns, but i want to add another new column as “status”.

So first declare a variable, i have takes as status the variable type is system.data.datacolumn and the default value is new system.Data.DataColumn(“Status”,GetType(System.String) ) so we have to tell what is our column name and what is the type of that.

Now in Add datacolumn activity use this status variable in column and provide the datatable.
Sequence.xaml (7.1 KB)

3 Likes

Thanks for your time.
Could you also please upload the corresponding json file, since I seem to be missing which libraries to use to be able to see the activities you’ve used in the workflow.image

project.json (688 Bytes)

Its just an 3 activities

Also, is it possible to insert values into the DataColumn before adding the DataColumn to a DataTable?

Hi @Athrix05,

If you try to do that you will get an exception, as cannot find column, so first you need to have to a column to add values to the column.

Correct me if I am wrong.
So even if I have initialized the DataColumn variable in the Variables pane, there is no way to add data into the DataColumn before adding the DataColumn to a DataTable?(ie, can a standalone DataColumn with data not exist?)

According to my understanding.

See, Datacolumn variable is representing datacolumn object you can assign a default value to this column as we have for int and boolean, but you cannot insert row values to a datacolumn variable of system.data.datacolumn variable type.

2 Likes

Ah, that clears it! Thank you so much!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.