Syntax for Specifying Column in a Data Table "Select"


#1

I have what appears to be a syntax problem and/or something simple I’m missing…

I can scrape a data table from a PDF invoice with “Extract Structured Data” activity:

…and write it out to a CSV file (with AddHeaders ticked):

When I try to extract the line items of each group from the data table into an array using Assign with a dt.Select:

arrLineItems = ExtractDataTable.Select(“Column-1=LN14VHG”)

for example, I get the error:

Assign : Cannot find column [Column].

I’ve tried various forms of “Column1”, “Column(1)”, “Column 1” but all variants throw an error. I’ve played around with the Meta data in “Extract Structured Data”, but to no avail.

I could, of course, use a For each loop - maybe that will teach me trying to be clever :blush:

So I called “Build Data Table” before scraping the table data from the invoice (I would like proper column Headings):

…to use an amended assignment:

arrLineItems = ExtractDataTable.Select(“Registration=LN14VHG”)

(or the string “Registration=LN14VHG”)

But the “Extract Structured Data Table” activity now only returns the defined column headers with no data :frowning:

If I add some dummy data using the “Build Table” activity then the .Select does not throw an error and the robot executes correctly. But CSV output files (one for each of three Registration numbers) are created, though none includes any of the scraped data.

So I have two problems that I’ve reached an impasse with. Firstly, for future reference, what is the syntax of the arrLineItems = ExtractDataTable.Select(“Column-1=LN14VHG”) - I can’t find any online help for dt.Select()? Secondly, why is the data table not being populated when I use “Build Table” before “Extract Structured Data Table”?

Process Invoice.xaml (20.2 KB)

AJ


#2

Please try with
ExtractDataTable.Select(“[Column-1]='LN14VHG'”)