hi,
i have one invoice pdf file . i used generative classifier .after that Extract document data. the output is idocument data .
i can write the data in text file. but unable to convert this data into datable.
Since the invoice line items are extracted as a table, I would recommend not converting the complete DocumentData object directly to a DataTable.
For the line-item field, access the table value from the extracted field and iterate through each extracted row. Then create a DataTable with the required columns and add each row separately using Add Data Row.
Also, make sure you are not using .ToString() on the table value, as that will combine the complete table into a single string/cell.
If possible, please share the field name/schema of the line-item table from the extracted DocumentData; then we can provide the exact expression for accessing the rows.
Hi @anand_kumar4 , ExtractedField(Of String()) ≠ String. Extract the .Value / individual value first instead of assigning the complete extracted field.
I see you are able to get data correctly until “InvoiceAmount” column. But you are getting line items data as a string into the “Quantity” column.
You can use For Each Row in DataTable activity and get that Quantity column value into a variable and then pass it to this workflow. This will create a new DataTable from which you can easily extract the data. GetTableItemsData.xaml (14.5 KB)
Your scalar fields such as InvoiceNumber, InvoiceDate, PurchaseOrder, ShippingAddress and InvoiceAmount are now working correctly.
The remaining issue is with the line-item table. Currently the complete extracted table is being converted/added as one value, which is why all Quantity, Item No., Description, Unit Price, Amount, etc. are appearing in a single cell.
Do not use .ToString() for the extracted table field.
Handle the line-item table separately:
Get the extracted table field from extract_Data.
Access its table/rows collection.
Loop through each extracted row.
Create a separate DataTable with columns such as: Quantity | ItemNo | Description | UnitPrice | Amount
Inside the loop, use Add Data Row to add one row for each invoice item.
Your invoice header DataTable and line-item DataTable should ideally be separate because one invoice contains one set of header values but multiple line-item rows.
If you share the exact table field name and its datatype/available properties from extract_Data.Data, we can provide the exact UiPath expression for iterating through the rows.