Write Dataset to Excel with Table mixed with Field

I am using Community Edition of the Studio and have successfully designed a workflow with Document Understanding by following instructions online. The Extraction portion is where I have a couple of issues:

Form Extractor=>Manage Templates => has a Table with 3 categories, along with 3 fields.
(1) the output looks like the picture below.
sample output
How should I write the dataset(0) such that it shows the Food Ordered (3 x 4 or 3 x up to 10) Details?
I don’t need to write the FoodOrdered in the Excel
As shown, I would like to see the resulting table details as supposed to just the word Table in cell A1. To make the Excel data explicit, I would like to repeat the fields with the same data covering the Food ordered details (Apple, Orange, Watermelon…)
How should I configure the “For Each” Loop and properties in order to have the desired results? Thanks.

Desired outputs result:

Ref Activities:
For Each

Ref Activity Properties.
For Each properties

Many Thanks.

@BeiJing0305

In the datatable field of write range please use currentitem

Also in the in argument please use like this dstcresults.Tables.Cast(Of DataTable)

Cheers

Thanks for your reply. Is the “DataTable” field the same as the “in argument”? Maybe I am not reading your suggestion properly. Please clarify.
I got this syntax error trying the “Cast Of”
syntax error

@BeiJing0305

This value is to be assigned in in argument/list of items field of for loop

And in the datatable firld of write ramge use currentitem

Cheers

revised screen capture.
syntax error2

sorry, I am not sure I understand your suggestions.
For Each

@BeiJing0305

Hope this clears your doubt

cheers

Thanks Anil_G. Worked! However, it only has 4 column. I don’t quite understand the new “For Each” works, I would appreciate some explanation. Current output as attached below, the phone and email columns don’t show up at all. And, Name shows up on time, which I supposed is expected. The phone and email data are in the DataTable as shown previous results. It just isn’t working the rest. How would
sample output3

If possible, how would I fill the rest of the name column with the applicable name for the order? See green text cell in the attachment below.
sample output3a

Does the Taxonomy have to in the same order as the Form Extractor in terms of Order? I am thinking if I were to de-select some fields and see if the rest of the columns would show up in Excel.

@BeiJing0305

Old for each had a type argument property which can be set as per each item you have in the list of items provided…but the new one does not have it…It would automatically try to understand the type…but for few it is unable to understand the type and will set to a different or wrong type…as in the dataset.Tables case…where it should identify as datatable but is identifying as object so explicitly for it to identify it as datatable we are using cast method so that it knows what to expect…Hope this is clear

Now coming to the name you can use auto fill range activity to fill the data in call the rows till the end of table

Regarding the missing columns we need to see what happended …because ideally if they are present it would be displayed…you can expand the extracted results in locals panel while running bot in debug mode to check what values are being extracted and in which fields…

If the data is present in separate fields then they might be extracted as simple fieds as well contrary to table fields

Cheers

1 Like

Thank you very much for the explanation. It seems confusing to design the “For Each” loop with the default that can’t be changed. I think I have figured out my issues. In examining the “Locals” panel, all the data are there It just wasn’t being written out property in Excel.

I changed the “Sheet1” static value to "currentItem.TableName. Now I have 4 sheets, sheet1(with the corresponding TableName) would have the single row of data, and the Sheet2 (with its corresponding TableName) now have the 3 x 3 Table.

How would I go about doing the “Write Range” such that it will show up in a signal sheet with the empty rows below the single row the same as the first row? And the 3x3 table immediately right of the single row of data without writing to another sheet.

Thanks.

@BeiJing0305

Just for clarity can you show how it is coming now and how you are expecting it to be?

One way would be to check how many columns are already populated and start the writing data from next column using write range

Cheers

Appreciate all the help. The new “For Each” is a bit counter-intuitive, however. Hope UiPath will “fix” this. I can’t be the only one who’s confused. :sweat_smile:

1 Like

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