Create a Procurement Cost Manager Power App using Receipt Processor

Introduction

AI Builder is a Power Platform capability that provides you the AI models to take leverage of artificial intelligence to optimize your business as well as automate processes. We can either use the already existing prebuilt models that suit ours needs to use the Power of AI in Power Apps or Power Automate or create our own custom AI models to suit some specific business needs. You can read more about AI Models in the Official documentation here. The out of the box prebuilt available models in AI Builder are:

  • Business card reader
  • Category classification
  • Entity extraction
  • ID reader
  • Invoice Processing
  • Key phrase extraction
  • Language detection
  • Receipt processing
  • Sentiment analysis
  • Text recognition
  • Text translation

In earlier days if we wanted to use any of these models, we had to call Power Automate and add the AI Builder actions to leverage the Cognitive abilities. However, more and more AI Builder capabilities are coming natively to Power App so that we can add them as controls to the App and directly interact with the AI Models based on our needs.

In this article, we will see how we can make use of the Receipt Processor within Power App without the use of Power Automate to read receipt information.

Scenario

We have a requirement where we want to manage the reading of multiple receipts and digitalize the procurement done by various teams in an organization. Manually entering the data could be a cumbersome process. To make the importing of data from receipts to a repository that can be used for creating Power BI cost-related reports, we will use the Recipient processor within the Power App, which can easily scan the receipts and extract the information and save it to the SharePoint List.

Graphical user interface, application

Description automatically generated

Implementation

As part of implementing the Receipt processor, let’s add the control from AI Builder to the Screen.

Graphical user interface, application, Word

Description automatically generated

In addition to that, we will also add Text Input controls that can be used to host the extracted information from the Receipt Processor.

Graphical user interface, application

Description automatically generated

In the above screen, all the fields except Purchased items are Text Input Controls.

For Purchased items, since it will be returning as a table, we will use an HTML Text control to better host the extracted data as multi-line values.

Extract Receipt Information

The Receipt processor uses its inbuilt model to extract the predefined receipt fields which we will show in the fields we have added in the form using the expression: ReceiptProcessor.<ReceiptField>

The Receipt Processing models have the capability to output the below information:

Property

Definition

MerchantName

Merchant name

MerchantAddress

Merchant address

MerchantPhone

Merchant phone number

TransactionDate

Transaction date

TransactionTime

Transaction time

PurchasedItems

The list of purchased items

  • Name: Name of the purchased item
  • Price: Price of the purchased item
  • Quantity: Quantity of the purchased item
  • TotalPrice: Total price of the purchased item

Subtotal

Subtotal

Tax

Tax

Tip

Tip

Total

Total

DetectedText

The list of all recognized lines of text on the receipt

We will assign the extracted value to the Default property of the control. In the case of Merchant Name, we set the value with the expression

ReceiptProcessor.MerchantName
Graphical user interface, application

Description automatically generated

We will use the below expression for populating the remaining controls

Control

Expression

Merchant Name

ReceiptProcessor.MerchantName

Bill Date

ReceiptProcessor.TransactionDate

Purchased Items

Concat(PurchasedItems, Name & “<br/>”)

Sub Total

ReceiptProcessor.Subtotal

Tax

ReceiptProcessor.Tax

Total Cost

ReceiptProcessor.Total

Apart from Purchased Items, the rest of the expressions, directly pick the data from the Form Processor output. Purchases Items return a table of procured items as a collection of multiple records. To show it as a multi-line text, we will initially capture the Purchased Items into a collection by using the below expression in the On Change of the Receipt Processor.

ClearCollect(PurchasedItems,ReceiptProcessor.PurchasedItems.Name)

This will save the Name of the Purchased Items into the Collection.

Graphical user interface

Description automatically generated

During run time, we can check the collection and see that it has been populated with the purchased items name as:

A picture containing graphical user interface

Description automatically generated

The Purchased Items are shown using an HTML Text Control. To combine the Purchased Items collection, we will use the Concat function and use the <br/> tag to create a multiline display.

Graphical user interface, application

Description automatically generated

Save the data

To Save the data to the back end, we will create a SharePoint List with the below columns

Graphical user interface, text, application, email

Description automatically generated

We will also create a connection to this list from Power App

Graphical user interface, text, application

Description automatically generated

With the connection added to the app, we can now use the Patch function to save the extracted information to the List using the expression:

Graphical user interface, application

Description automatically generated

Test the App

Let’s test the app by previewing it, we can upload a receipt and the receipt processing model will extract the information from the receipt and populate the form. Clicking on Save will eventually save the data back to the list.

Summary

Thus, we saw how we can use the Receipt processor directly within Power App to extract the information in the receipt and save it back to the SharePoint List

Related Articles

Author

Author

Priyaranjan KS is a Modern Workplace Architect primarily focused on developing and architecting solutions around Office 365,Power Platform and Azure.He is also a Microsoft Most Valuable Professional(MVP) and a Microsoft Certified Trainer(MCT)

Latest Articles