Why cannot extract data from PDFs more than 7 columns

Hi everyone, can help me how to get more than 7 columns? if I try and put the data rows more than 6, error popped out as not assigned.

{dtData.Rows(0).Item(“Value”).ToString,dtData.Rows(1).Item(“Value”).ToString,dtData.Rows(2).Item(“Value”).ToString,dtData.Rows(3).Item(“Value”).ToString,dtData.Rows(4).Item(“Value”).ToString,dtData.Rows(5).Item(“Value”).ToString}

@Binti_Sulaiman_Nurulain_A

Welcome to the community

Can you please elaborate where you aregetting the eror

Cheers

1 Like

Hi @Binti_Sulaiman_Nurulain_A

I believe you are trying to access 7th row and not 7th column

Please check the number of rows in the data table. If it contains only 7 row - the index will be starting from 0 till 6. This could be the reason why you are getting error when you try to fetch details from 7th row using index figure 7

Check the number of rows and dynamically allocate values till the index ends

1 Like

Thank you, please refer attached image. If i put my rows more than 6, it will be getting an error. I need to put more data tables on my excel

Yes correct, I have put the data table also. please refer below image. and my other data table also complete 7 rows

Hi @Binti_Sulaiman_Nurulain_A , if you are trying to extract information from a document using different regex strings, use the For Each Row in Data Table activity, then get the regex using CurrentRow("Regex").ToString.

1 Like

Sorry sir, can you help to elaborate more, this is my assign and match

Hi @Binti_Sulaiman_Nurulain_A , currently you have a datatable with 3 columns- Field, Regex and Value. I am assuming you want to match the document with Regex and write the result to the Value field?

  1. Use For Each Row in Data Table activity and select dtData as the detatable
  2. Now you get a single row per iteration
  3. For the Find Matching Patterns, use CurrentRow(“Regex”).ToString as the regex pattern
  4. Under the Find Matching Patterns → Properties, you can directly fill in the First Match to fill the datatable: CurrentRow(“Value”)

@Binti_Sulaiman_Nurulain_A

As per error one of the variable or value is null or empty

Looks like may be your last regex is giving null

Cheers

Hi sir, thanks for your response. Its worked :smiley:
Thanks sir.

Can you help how to put regex on this sentence.
37. Insurans (AA/AB) : 0.00
38. Nilai Maklon (Jika Ada) : 77.03

Thanks sir, I have checked some of my variable also empty.

1 Like

@Binti_Sulaiman_Nurulain_A

Ideally you dont need regex str.split(":"c).Last.Trim would give the value

Happy Automation

Cheers

1 Like

Hi @Binti_Sulaiman_Nurulain_A ,

I’m guessing you are supplying the whole doc content as a string variable? - if yes, then please use these regex:

(?<=Insurans\s+\(AA\/AB\)\s+:\s+)[\d\.,]+

(?<=Nilai\s+Maklon\s+\(Jika\s+Ada\)\s+:\s+)[\d\.,]+

Thank you sir, got it :slight_smile:
I have another question, can we include extracting the file name in the data table as well

Hi @Binti_Sulaiman_Nurulain_A ,

strFileNameVar is the string variable holding the file name. If the file name is the full path, you may use:

Path.GetFileName(strFileNameVar)

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