Datatable merging

I am trying to merge two data tables. Table x has a,b,c,d,e,f columns and table y has two columns, now initially during the process table x has a,b,d,e columns filled and then later during the process, ill get values for columns c and f from table Y. how will i merge the table y- into table x and fill it under columns c and f in table X. Please help

1 Like

Buddy
The process that you did earlier like getting value for c and f from table y is feasible by getting the column from second table and inserting to our first table and you cannot use merge table here…the reason whenever we want to merge them , it implies that both the table has same set of columns, same no. Of columns, same order of columns and same Datatype of columns…as the one you have tables of different column we cannot term it as merging buddy @shreyaank…rather we can call like inserting the column from one table to another which can be done by this,

  1. Get the datacolumn from table y like
    Out_datacolumn_1 = datatable_y.Columns(“columnname”)
    Similarly for
    Out_datacolumn_2 = datatable_y.Columns(“columnname”)

Where both Out_datacolumn_1 and Out_datacolumn_2 are type datacolumns

  1. Now use invoke method to insert those columns at specific position…
    Or you can still follow the method that you were doing already like getting value while the process execute…
    Cheers buddy @shreyaank
2 Likes

Hi @shreyaank,
Check the following links out:


Hope it helps

Regards

Hi @shreyaank
Please see this solution:
Read excel from a given file folder

Hope this helps.
Thanks and regards,
Despi

2 Likes

How do i use the Invoke method to bring in the columns from table Y inside Table X? Can you please help on this?

1 Like

here is your xaml buddy @shreyaank
a sample of how to add a new column at desired position,
where you can change the position by changing the parameter int value with 0, 1, or 2 where they represent the index of the column buddy

like you can use two invoke methods for your case and the add the datacolumn buddy @shreyaank, by mentioning the datacolumn you obtained buddy

this one edited buddy @shreyaank
invokeaddcolumn.xaml (9.9 KB)

Kindly try this and let know buddy whether this works or not
Cheers

kindly find the new one added @shreyaank
and let know whether this works or not buddy
Cheers @shreyaank