Activities
latest
false
Banner background image
Document Understanding Activities
Last updated Apr 10, 2024

Document Processing Using FlexiCapture Scope

The example below explains how to use the Abbyy package and integrate it into the UiPath workflow. The files are gathered, classified, processed and validated. Once all steps are confirmed, an .xlsx file is created, including the final output. It presents activities such as Validate Document, FlexiCapture Scope, Get Field, Get Table, and Classify Document. You can find these activities in the UiPath.Abbyy.Activities package.

This is how the automation process can be built:

  1. Open Studio and create a new Process named by default Main.
  2. Drag a Sequence container in the Workflow Designer and create the following variable:

    Variable Name

    Variable Type

    Default Value

    filePaths

    System.String[]

     

    data

    DataTable

     

    i

    int32

     

    table

    DataTable

     
  3. Drag an Assign activity in the sequence container.

    • Add the variable filePaths in the To field.
    • Add the expression .directory.GetFiles(in_ImagesFolderPath) in the Value field.
  4. Add a Build Data Table activity under the Assign activity.

    • In the Properties panel, add the variable data in the DataTable field.
    • Click on the DataTable button to define your table columns.
    • Click on the Add Column button. In the new window, add the name of the column in the Column Name field.
    • Select the String value from the Data Type drop-down list.
    • Select the check box for the Allow Null option. This allows null values to be added in this column.
    • Once all columns are added, select the OK button to close the window.
    • This is how your DataTable should look:



  5. Drag a For Each activity below the Build Data Table activity.

    • Add the name file in the Item field.
    • In the Properties panel, add the variable filePaths in the Values field and the variable i in the Index field.
    • Select the String option from the TypeArgument drop-down list.
  6. Add a FlexiCapture Scope activity in the body of the For Each activity.

    • Select the Do sequence from the activity's body and create the following variable:

      Variable Name

      Variable Type

      Default Value

      classification

      String

       

      document

      UiPath.Abbyy.Core.FlexiCapture.FCDocument

       

      field

      UiPath.Abbyy.Core.FlexiCapture.FCField

       
  7. Drag an Add Data Row activity inside the Do container.

    • In the Properties panel, add the expression {} in the ArrayRow field and the variable data in the DataTable field.
  8. Place an Assign activity below the Add Data Row activity.

    • Add the expression data.Rows(i)("FileName") in the To field and the name file in the Value field.
  9. Drag a Classify Document under the Assign activity.

    • Insert the expression {in_FCDotFilePath} in the DefinitionFiles field.
    • Add the value file in the SourceDocument field.
    • Add the variable classification in the Result field.
  10. Drag an Assign activity.

    • Add the expression data.Rows(i)("Classification") in the To field and the variable classification in the Value field.
  11. Place a Process Document activity under the Assign activity.

    • Add the expression {in_FCDotFilePath} in the DefinitionFiles field.
    • Add the value file in the Document field.
    • Add the variable document in the Result field.
  12. Place a Validate Document activity under the Process Document activity.

    • Add the variable document in the Document field.
    • Add the variable document in the Result field.
  13. Drag a Sequence container and name it Company Name.
  14. Drag a Get Field activity inside the Company Name sequence.

    • In the Properties panel, add the variable document in the Document field.
    • Add the expression "CompanyName" in the Name field.
    • Add the variable field in the Result field.
  15. Drag an Assign activity under the Get Field activity.

    • Add the value data.Rows(i)("Company Name") in the To field and the expression field.Value in the Value field.


  16. Return to the Do container and drag a new Sequence activity under the Company Name container.

    • Name the new sequence Customer Number.
  17. Drag a Get Field activity inside the Customer Number sequence.

    • In the Properties panel, add the variable document in the Document field.
    • Add the expression "CustomerNumber" in the Name field.
    • Add the variable field in the Result field.
  18. Drag an Assign activity under the Get Field activity.

    • Add the value data.Rows(i)("Customer Number") in the To field and the expression field.Value in the Value field.


  19. Return to the Do container and drag a new Sequence activity under the Customer Number container.

    • Name the new sequence Email.
  20. Drag a Get Field activity inside the Email sequence.

    • In the Properties panel, add the variable document in the Document field.
    • Add the expression "Email" in the Name field.
    • Add the variable field in the Result field.
  21. Drag an Assign activity under the Get Field activity.

    • Add the value data.Rows(i)("Email") in the To field and the expression field.Value in the Value field.


  22. Return to the Do container and drag a new Sequence activity under the Email container.

    • Name the new sequence Date.
  23. Drag a Get Field activity inside the Date sequence.

    • In the Properties panel, add the variable document in the Document field.
    • Add the expression "Date" in the Name field.
    • Add the variable field in the Result field.
  24. Drag an Assign activity under the Get Field activity.

    • Add the value data.Rows(i)("Date") in the To field and the expression field.Value in the Value field.


  25. Return to the Do container and drag a new Sequence activity under the Date container.

    • Name the new sequence Delivery Address.
  26. Drag a Get Field activity inside the Delivery Address sequence.

    • In the Properties panel, add the variable document in the Document field.
    • Add the expression "DeliveryAddress" in the Name field.
    • Add the variable field in the Result field.
  27. Drag an Assign activity under the Get Field activity.

    • Add the value data.Rows(i)("Delivery Address") in the To field and the expression field.Value in the Value field.


  28. Return to the Do container and drag a new Sequence activity under the Delivery Address container.

    • Name the new sequence Billing Address.
  29. Drag a Get Field activity inside the Billing Address sequence.

    • In the Properties panel, add the variable document in the Document field.
    • Add the expression "BillingAddress" in the Name field.
    • Add the variable field in the Result field.
  30. Drag an Assign activity under the Get Field activity.

    • Add the value data.Rows(i)("Billing Address") in the To field and the expression field.Value in the Value field.


  31. Return to the Do container and drag a new Sequence activity under the Billing Address container.

    • Name the new sequence Invoice Number.
  32. Drag a Get Field activity inside the Invoice Number sequence.

    • In the Properties panel, add the variable document in the Document field.
    • Add the expression "InvoiceNumber" in the Name field.
    • Add the variable field in the Result field.
  33. Drag an Assign activity under the Get Field activity.

    • Add the value data.Rows(i)("Invoice Number") in the To field and the expression field.Value in the Value field.


  34. Return to the Do container and drag a new Sequence activity under the Invoice Number container.

    • Name the new sequence Total CHF.
  35. Drag a Get Field activity inside the Total CHF sequence.

    • In the Properties panel, add the variable document in the Document field.
    • Add the expression "TotalCHF" in the Name field.
    • Add the variable field in the Result field.
  36. Drag an Assign activity under the Get Field activity.

    • Add the value data.Rows(i)("Total CHF") in the To field and the expression field.Value in the Value field.


  37. Return to the main Sequence container.
  38. Drag an Excel Write Range activity under the For each activity.

    • In the Properties panel, add the value "Sheet1" in the SheetName field.
    • Add the value "A1" in the StartingCell field.
    • Add the variable data in the DataTable field.
    • Add the expression "OCR_Results.xlsx" in the WorkbookPath field.
    • Select the AddHeaders check box for considering the first row of the table a header.
  39. Drag a FlexiCapture Scope activity below the Write Range activity and create the following variable:

    Variable Name

    Variable Type

    Default Value

    doc

    UiPath.IntelligentOCR.FC.FCDocument

     
  40. Place a Process Document activity inside the Do container of the IntelligentOCR Scope activity.

    • Add the expression {in_FCDotFilePath} in the DefinitionFiles field.
    • Add the expression filePaths(0) in the Document field.
    • Add the variable doc in the Result field.
  41. Drag a Get Table activity under the Process Document activity.

    • Add the variable doc in the Document field.
    • Add the expression "LineItems" in the Name field.
    • Add the variable table in the Result field.
  42. Drag a Write Range activity under the IntelligentOCR Scope activity.

    • In the Properties panel, add the value "Table Example" in the SheetName field.
    • Add the value "A1" in the StartingCell field.
    • Add the variable table in the DataTable field.
    • Add the path "OCR_Results.xlsx" in the WorkbookPath field.
    • Select the AddHeaders check box for considering the first row of the table a header.
  43. Run the workflow. The automation process creates a new workbook with all classified, processed, and validated data.

Download example from here.

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.