Creating a Default DataTable for use in input Argument

Hi,

I am building a process on UiPath that uses an input argument of a DataTable to perform tasks. It will be part of a larger framework but I need it to avoid running with blank data so default data can be used if no input is provided.

How would one write this in order to allow for a DataTable to start with a default value to avoid the nulls.

Thanks in advance.

P.S. I would prefer to avoid using excel spreadsheets if possible

Hi
Define with a default value as New System.Data.Datatable
to validate this for example
check with the row count of a variable it will give us 0

Cheers @Lewis.Henderson

1 Like

Great! which commands can I use to add Column and Row data?

1 Like

We can use Build datatable activity itself to create a table structure with the required columns we want
Either we can add the row and it’s value there itself
Or we can get the output from build datatable activity as a variable of type datatable named dt
—now use a ADD DATAROW activity and mention the datatable input as dt and in arrayrow property mention the column values as a form of array
Like if we have five columns we should mention only five elements in a array like this
{“value1”,”value2”,”value3”,”value4”,”value5”}
So it means we have five columns in the datatable dt

Cheers @Lewis.Henderson

worked. Thanks a lot. Would you please describe what will New System.Data.Datatable return?