While i was going through developer certification learning path, in one of the courses related to Excel automation, i was following the video to create workflow myself but in one of the activity “Merge Data Tables”, there are source field & destination field, source field is already populated with previous activity data to read data from Excel & destination field has been populated by source DataTable object. Inspite of that, the video initialize the variable with new DataTable . Why ?
@ravish_mahajan
welcome to the forum.
some datatypes (simple datatypes like a string, int32…) can be used directly
other datatypes (complex datatypes like a list, datatable) needs to be initalized before usage
there we do initialize it with a new DataTable() and get back a datatable var without any configured DataColumn and empty (no rows)
Initializing the destination DataTable variable with a new DataTable in the video is likely done to ensure that the workflow is robust, clear, and free from potential issues caused by uninitialized or improperly structured variables. This practice helps create reliable automation processes in UiPath.
Thanks,
Ashok ![]()