Merge Data Table: 'table' argument cannot be null. (Parameter 'table')

Hi,

I am getting the error while merging 2 datatables. how to merge the data tables without the error.

Regards,

Hi @raju_alakuntla ,
Can you share you input and expect output ?
regards,
LNV

Hi @raju_alakuntla

Screenshot the error and upload the attachment then it will be better for us to understand the error.

In Merge datatable activity, the two datatables columns must be same.

Hope it helps!!

@raju_alakuntla

The error message “Merge Data Table: ‘table’ argument cannot be null. (Parameter ‘table’)” indicates that you are trying to merge data tables in UiPath, but one of the input data tables is null. To resolve this issue, you need to ensure that both data tables are properly initialized before attempting to merge them

Check the datatable argument passing if you are using arguments in your workflow.
Check the datatables if any one does not have data

I am able to execute it without error now.

I have 2 excel files where first one contains Names students with some subjects(Like Mathematics and Chemisty) marks filled in the marks column and other file contains same students name with other subjects (Physics and Social studies) marks filled. But its duplicating the names of the students. How can we merge Properly by without duplicating the names.

Regards,

Okay @raju_alakuntla

After merging the datatable you have the one output of datatable. Let’s call it as dt_merge (Datatable datatype).
Use remove duplicate rows to remove the rows which has duplicates. In the datatable field pass the dt_merge datatable variable.

Check the below image
image

Hope it helps!!

I used it but not deleting the duplicates.

It will delete the rows which was the total row has duplicate values. If any value in the row is changed then it will not delete the rows.

Or If you want to delete the duplicates with any specific column, let me know then we will do in another way.

Hope you understand!! @raju_alakuntla

Hi @raju_alakuntla
dataTablevariable=
Datatablevaraible.AsEnumerable().GroupBy(Function(i) i.Field(Of String(“columnWithDuplic”)).Select(Function(g) g.First).CopyToDataTable

This remove duplicates based on a specific colunmn name

2.Remove duplicate rows activity
will remove entire row if duplicate row found.

Hope this helps you

@raju_alakuntla

Try using join activity on the names columns

Cheers

Input 1:
image

Input 2:

Output looks like adding duplicates.

How to delete the duplicates.

Hi @raju_alakuntla

Use join datatable activity
And use join type as inner join

This will give you the excpected output

Should I use any Column names in the condition?

@raju_alakuntla

Yes
Can you pass your column names which need to compare

Let me know if your requirement is not met

Cheers

My requirement is to merge the data Under “Reasons” column and “Additional Comments” column from different excels against the “Name”.

Merge datatable is giving the desired output but again writing the excel1, 2, 3 data after the desired output. Its not our requirement. We need only merged data.

How can I delete the unwanted data.

After merge datatable

Use this

dataTablevariable=
Datatablevaraible.AsEnumerable().GroupBy(Function(i) i.Field(Of String(“columnWithDuplic”)).Select(Function(g) g.First).CopyToDataTable

This remove duplicates based on a specific colunmn name
Or
Datatable.defaultview.totable(true)

Which remove duplicate rows

3.Remove duplicate rows activity
will remove entire row if duplicate row found.

Hope this helps you

can you explain me more. I didn’t understand it.

I used “Remove duplicate rows” activity too but not removing.

It is again writing all the columns. I need to remove the duplicate rows.

Datatablevariae.defaultview.totable(true)
Try this

Or to remove duplicates based on specific column use this
Datatablevaraible.AsEnumerable().GroupBy(Function(i) i(“columnWithDuplic”).tostring).Select(Function(g) g.First).CopyToDataTable

where can I use this “Datatablevariae.defaultview.totable(true)”. I mean which activity.

Place this in assign activity
Left side datatable variable right side above expression

after merge datatable