Hi, I am trying to use a nested data table but I am stuck on how to read the inside data table. I am quite new to UIPath so this might be a trivial issue. Please excuse me for that.
Issue in detail as below
I have a data table say customerInvoiceListTable with 2 columns in it. The first column is Customer Name (Data type as String) and the second column is Invoice Table (Data type as DataTable with 3 columns in it viz. Invoice Number, Invoice Date and Invoice Amount). I populated this table with my data based on certain logic.
Now I have to use my data table “customerInvoiceListTable” to create an excel with one sheet for each of the customer and list of invoice details (Invoice Number, Invoice Date and Invoice Amount).
I am using For Each Row to read the data table. I am able to get the Customer Name as its String. I am using : row.Item(1).ToString
Now I do not know how to get the second (inner) data table which is the second column of my data table.I am using row.Item(2). ???
What to use to type cast it to a data table, I have no idea.
Please some one can advise on this.
Sorry i dont get the question ?
Do you have datatable inside the dattable is that correct.can you please share more details like putting the sample excel and the output that you want to easily address the issue.
cheers
Happy learning
hi pattyricarte
yes i have a data table inside the other data table. please see the image below
my data table is having only 2 columns. the first one is the customer name which is a string and the second column is invoice table which is having data type as Datatable. so this datatable should look like this
customer1,<customer 1 invoice details table>
customer2,<customer 2 invocie details table>
customer3,<customer 3 invocie details table>
and so on
The invoice details for each customer will have data like
Invocienumber1,InvocieDate1,incvoicemaont1
invocienumber2,invocedate2,invocieamont2
and so on
I have to loop around my data table and extract customer and its invoce details from each row.
like first row wIll give me Customer1 String from first column and the second column should give me a data table with invoce details for customer 1.
hope i made this clear.
now when i am using for each row i am able to convert the customer name to string but i do not know how to convert invoice detail to a data table.
for each row in customerInvoiceListTable
customer name = row.Item(1).ToString
invoice detail table =row.Item(2). WHAT SHALL I USE HERE TO GET THE INNER TABLE
please see image and error
Dont pass object to the input of Write range ! You need to pass Variable type of Datatable !
cheers
Happy learning
By the way wheres the dattable coming from ?
Is that an excel that you read. ?
cheers
Happy learning
sorry as i mentioned earlier, i am a newbie to Uipath.
please can yo advise how do i pass datatable variable to write range?
@pattyricarte i am not reading the excel. i am getting the details from website passing 1 customer name getting their invoice detail and hen i have to write this in excel. I can do like readin 1 customer detail and open excel writing to excel and close it. then again read customer detail from website open excel , write and close. But I want to avoid this multiple opening of excel.
i just want to read customer invoce detail one by one, store it in a table and then at last dump into excel.
No worries it’s fine Its ok were here to help!
Scenario
1.The first text box you need to pass the sheet name of your excel.
2.The second text box you need to pass the variable data type of datatable.
3.In the variable pane you need to create variable data type of datatable.
See image below for your reference…
cheers
Happy learning
Hmmm can i see the format of your website So that we can come up with the logic
cheers
Happy learning
exactly this is what i want to do. but the problem here is to populate this variable. I have to read the second column of my "customerInvoiceListTable” and assign it to this variable. how do i do that. i am reading it by using row.Item(2) but its givng an object. how do i convert this to datatable data type?
Hi I already sent the scenario for you see the topic above for your reference.
cheers
Happy learning
my website would be something like this. a very simple one
now by passing customer name i will get invoice table for each of customer. which i will store in my nested table “customerInvoiceListTable” with customer name in first column and invocie table in the second column
now once i am done with all the customers. i need to dump this in the excel by readin each row of my nested table
the first column of each row will give me customer name which i will use to name my sheet name and the second column will give me the invocie data table. but i do not know how to read this inner table from the row.Item(2). ???
Hmmm iget it now. Please wait i will create scenario for these and confirm it.
cheers
Happy learning
since i am new user i am not allowed to upload attachment. My excel will look like this
ok sure i will wait pattyricarte
thanks a lot @pattyricarte for your help
Ok
Scenario
1.We need to know how many customer that we are trying to retrieve in the website.For us to know how we iterate in the loop.Maybe we can start by getting the value in the website and Write the value in the excel in different sheets using the customer that we retrieve in the website.Please confirm it so that i will create you xaml for this!
cheers
Happy learning
Maybe i will create a 4 customer and iterate it through the loop and create the excel with different customer.And you are the one who will scrape the data in your website .
Is that fine @msk
cheers
Happy learning
Number of customer might vary.
yes to begin with 4 customer should be OK. i just need to understand the logic on how to read inner table. thanks
When you say inner table you are refering to the highlighted below am i correct?
Please confirm so that i can come up with the logic. Thanks
cheers
Happy learning