When using the Column* section in Add Data Column Activities why did defaultValue not work?

When I entered a variable in the Column* section, the default value didn’t work.
But when I use Column Name* section in Add Data Column Activity my default value worked.
Please tell me, why this happened.



Default value

@Md_Raiyan_Khan

This property is set for column name and not column . So default value works for column name

DefaultValue - Specifies the default value for the new column when creating new rows.

1 Like

@Md_Raiyan_Khan

Column is datacolumn datatype but column name is String type so it will consider your default value

1 Like

Hi @Md_Raiyan_Khan

If you pass the Variable in the Column filed the option properties under this activity is ignored.
If you give the Column Name in the Column Name field the properties will work.

Find the below image for your reference.
image

Hope it helps!!

1 Like

If you have got the answer to your query kindly mark as solution and close the thread

For further information on this topic you can have a look at

[https://docs.uipath.com/activities/other/latest/workflow/add-data-column]

Regards,

1 Like

Hi @Md_Raiyan_Khan

The “Column” property expects a variable that specifies the data type and name of the column. However, this property does not have a direct field for setting the default value.

The “Column Name” property expects a string value, which is the name of the column you want to create. When you use this property, UiPath will automatically create a new column with the specified name in the DataTable and infer the data type based on the default value you set.

If you want to create a new column with a default value in the “Add Data Column” activity, you should use the “Column Name” section and set the default value before adding the column to the DataTable. If you use the “Column” section, you can still create a new column, but you’ll need to handle the default value separately, such as setting it later in a loop or using other methods.

Hi @Md_Raiyan_Khan

  • When using the “Column Name*” property, you are specifying only the column name, and the default value is a separate property that you can set.
  • When using the “Column*” property, you are providing the entire DataColumn object, and the default value should be set as part of the DataColumn object with the appropriate data type.

@Md_Raiyan_Khan

Data Type Mismatch: The “defaultValue” property should be set with a value that matches the data type of the DataColumn being created. For example, if you are creating a column of type Integer, the defaultValue should be an Integer value, and similarly for other data types.

It was a good question. @Md_Raiyan_Khan

If you got the solution for your query make mark it as solution which helps others.

Happy Automation!!

Thanks @B_H_Akshatha_Pai
now it’s clear for me

1 Like

@Md_Raiyan_Khan
If You have any further queries then please dont hesitate to ask

If not kindly mark as a solution such that it will help the community

Below link points out the steps to mark a post as a solution
[Forum FAQ - How to mark a post as a solution]