cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Extracting PDF data with Form Recognizer and saving it to Sharepoint

Hi all,

 

I am currently trying to extract data from a PDF file with Microsoft Form Recognizer whenever

a file is uploaded on my Sharepoint site. The extracted data shall be added to the original file as Metadata.

Everything worked quite fine besides the usage of the template language expression to use the JSON output from Form

Recognizer to find the adequate key - value pairs and add their data to the PDF.

 

The JSON output from Form Recognizer looks like this:

grafik.png

 

My Flow looks like this:

grafik.png

 

In update file properties I try to get the data from JSON via the expression:

It seems to be working because I do not get an error anymore but the metadata field is empty.

 

body('Parse_JSON')?['pages'][0]?['Datum:']?['value']
 
if I try any other Index than [0] I get this error and I do not understand why:
grafik.png
 
To be honest I do not really understand the template language expression and how to iterate through an array.
Additionally it does not make too much sense for my purpose because I wanted to be able to
analyze documents with another format as well. Whenever the key - value pair I want to extract is in another line it would not 
work if I work with Indexes.
 
I would appreciate any help.
 
Best regards,
AdriP
 
1 ACCEPTED SOLUTION

Accepted Solutions
manuelstgomes
Community Champion
Community Champion

Hi @Anonymous 

 

You need to include the "body('Parse_JSON')?['pages'][0]?['Datum:']?['value']" into a "Apply For Each" and then perform your actions. 

 

Something like this:

Screenshot 2020-01-02 at 09.43.54.png

 

The error message is indicating that you're trying to use an array that is empty, so it's trying to access position 1 but that position is not available.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

View solution in original post

1 REPLY 1
manuelstgomes
Community Champion
Community Champion

Hi @Anonymous 

 

You need to include the "body('Parse_JSON')?['pages'][0]?['Datum:']?['value']" into a "Apply For Each" and then perform your actions. 

 

Something like this:

Screenshot 2020-01-02 at 09.43.54.png

 

The error message is indicating that you're trying to use an array that is empty, so it's trying to access position 1 but that position is not available.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (2,232)