Contact Us 1-800-596-4880

Lab 1: Implementation - Extract the Invoice Total

Overview:

In this lab we will extend the Extract Data activity to extract through OCR the Invoice Total value that we missed in the previous module.

Prerequisites

Before starting

If you have not completed the previous module/lab then you should import the solution into your RPA Builder to ensure that you begin this lab from the right place.

Importing previous module solution

You should have the Google Drive link sent to you along with the credentials and other workshop material. This drive contains the solution for all labs. If you do not have access, ask the instructor.

  1. From your Windows VM, download the Module_1_Lab_5_completed.crpa file referred to the solution of the previous lab.

  2. Open RPA Builder and open the project you want to overwrite with the lab solution. Make sure you open YOUR project to avoid overwriting other users' work.

    module2 lab01 repo proc listing
  3. Once opened, click the Import Project option under the File menu:

    module2 lab01 import process
  4. Click Yes in the confirmation dialog; locate your downloaded .crpa file and click Open to import it.

You can now continue with the lab.

Step 1: Extract the Invoice Total value from invoice

  1. Open the Extract Data exiting activity and drag and drop a new Group just after the Extract Invoice information one. Name it as Extract Invoice Total.

  2. Drag and drop a new AI OCR (file-based) step into the group and name it as Get Invoice Total.

    Provide the path and file name pinned to the Activity Parameters.attachmentsTemporaryFolder and Activity Parameters.attachmentFilename.

    Click on the Load design-time file button and select the Automation Workshop Invoice.png file located in the Learners_Repository\Student Files folder.

    module01 lab03 065
  3. Click the Define scan area button to set the scan area of the data will be extracted as shown below. Make sure you do not include the EURO character in the selection:

    module2 lab01 001

    For better results, make sure to set the Scaling factor to x2.5:

    module01 lab03 063

    Click Save to continue and Test to test the settings. You should get the following results:

    module2 lab01 002

    The exact data extracted should be:

    458,59↲

    (including the CRLF character!)

    Click Close and OK to close the wizard.

  4. As with the other invoice data extracted in the previous module, the data we have just extracted includes the CRLF character and we need to get rid of it.

    Drag and drop a String Operations step and name it as Remove CRLF. Set the String Operation to Find and replace text

    Pin the Input text to Get Invoice Total.Recognized Text

    Check the Use a regular expression for 'Find what', set the Find what to:

    (\n?\r?)

    and leave the Replace with empty.

    module2 lab01 003

    Click OK to save and close.

  5. You can notice that the extracted text (458,59) contains a , as the decimal separator and we must convert it to . before moving on.

    Drag and drop a new String Operations step and name it as Change decimal separator. Set the String Operation to Find and replace text

    Pin the Input text to Remove CRLF.Result.

    Set the Find what to , and Replace with with .:

    module2 lab01 004
  6. Drag and drop a Set Variable step and name it as Set invoiceTotal

    Set the variable to Activity Parameters.invoiceTotals and value to Change decimal separator.Result:

    module2 lab01 005

    Click OK to save and close.