Question regarding the merge table

Hi there,

I am having the bot scrape two separate columns from a portal which do not have headers (the portal is quite badly designed!); what I’d like to do with them is merge them to be side-by-side, but when I try and do so, it just appends them.

I have tried to create a new datatable to add them to separate columns, but can’t seem to get it right.

Eg:
scrape 1:
Product1
Product2

Scrape 2:
Price1
Price2

Result:
Product1
Product2
Price1
Price2

Required:
Product1 Value1
Product2 Value2

How can I go about doing this? Apologies for the basic question here, I’m still not a pro with UiPath aha. Thanks for your help.

Find some starter help for a side by side merge

SideBySideMerge_AlsoDifferentRCnts.xaml (10.8 KB)

2 Likes

If you are scraping the data into two Datatables and want to merge sid by side. You can try this-
Scrape1(in Datatable1) and scrape2(in datatable2)
Add data column to Datatble1
For each row in Dtatatble1
assign values from datatable2 to datatble1 using Index
ex: item(1) = datatable2.rows(idx)(1).tostring

Hey Peter,

Thanks for reply, the last assign gave me this error: Assign: Input array is longer than the number of columns in this table.

just share with us your implmentation, so we can check for inconsitencies when helper xaml was integrated

This sounds like it might work, but I’m a bit confused as to final point and example - do you have visual I could refer to, by any chance? Thank you!

I pretty much copied exactly what you did, but changed the result to ‘pDT’ (new blank data table) and the other two to merge pColDT1/2.

feel free to let us inspect or crosscheck working helper xaml against your individual modification

issue is about that the dimension of the row array is not correct. so the column schema merge part should be reviewed at your custom modelling

I meant: I copied it exactly but just changed variable names.

The source in merge data table is ‘item.clone’.

Maybe it has something to do with the lack of headers (you have some in the one you built)
image

set a breakpoint at the for each

  • run debug file and get paused by the breakpoint from above
    type into the immediate panel:
    pCol1DT.Columns
    pCol1DT.Columns

and share with us the output

Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

mabye some col names are the same within the two datatables and get consolidated by the datatable clone schema merge

1 Like

I think you are correct again, sir. How do we remedy this?

image

How about following?

grafik


dtData - replace with your second DT: pCol1DT
item.columnName.Trim = item.columnName.Trim & “_B”

so we mark the second dt cols to avoid duplicate names. Later we can also change as needed

I managed to just add an assign after the new DT assign of ‘pCol2DT.Columns(0).ColumnName’ = “Column2” and that has worked.

Thank you very much, your help is always appreciated!

image

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.