Build a bot to upload documents to Automatización de documentos

Build a bot to upload documents to a specific learning instance for processing and extraction.

Antes de empezar

  • Ensure you have the name of the destination learning instance.
  • If you have an adequate amount of Instancias de Bot Runner connected. For instructions on connecting a Bot Runner, see step 5 of Configurar el entorno del usuario de Automatización de documentos.
    Nota: You need a dedicated Bot Runner for this bot and additional Instancias de Bot Runner for the extraction and download bots, depending on the average number of pages in the documents. Review the explanation below for more guidance on how many Instancias de Bot Runner are needed.
  • Decide on the scheduling interval for deploying this bot with a maximum interval of every thirty minutes.
  • Determine the average number of pages in the documents awaiting upload.
This bot is necessary for end-to-end automation of the document extraction process. When deployed, the bot checks if there are enough Instancias de Bot Runner to handle the documents, by comparing the number of files already uploaded against a calculated value. The calculation considers the number of Instancias de Bot Runner, scheduling interval, and average number of pages in the documents.
Nota: This step is important as it controls the number of documents being uploaded to ensure smooth processing and avoid overloading the Instancias de Bot Runner, which might cause a time-out error.
To determine the number of Instancias de Bot Runner needed, consider the following:
  • One Bot Runner can process a single-page document in one minute.
  • One Bot Runner can process a two-page documents in two minutes.
  • One Bot Runner can process 1440 single-page documents in one day.
  • Two Instancias de Bot Runner can process two single-page documents in one minute.
Use this equation to determine how many Instancias de Bot Runner are needed:
Number of Documents to Process per day * Average Number of Pages per document / 1440 = Number of Instancias de Bot Runner
Nota: If the equation result is not an integer, you must round up to the next whole number to obtain an adequate number of Instancias de Bot Runner. For example, if the equation result is 4.2, you will need 5 Instancias de Bot Runner.

To learn more, search for the Document Automation Developer course in Automation Anywhere University: RPA Training and Certification (A-People login required).

As an example, if you want to process 10,000 documents each day with an average of one page per document, you need seven Instancias de Bot Runner:
10,000 documents * 1 page per document / 1440 = 7 Instancias de Bot Runner

Procedimiento

To build the bot, follow these steps:

  1. Navigate to Automation > Private tab and click Create a bot.
    Ensure you do not place the bot in the Document Workspace folder.
  2. Provide a name for the bot, such as Extraction-Scheduler.
  3. Create the following variables: Crear una variable
    Variable name Description Data type Value
    File_Count Increments with each loop iteration to count the number of files uploaded for processing. Number 0
    Extraction_DeviceCount Number of Bot Runner devices connected to the Control Room Number Enter the number of connected Bot Runner devices
    Scheduler_Interval Scheduling interval in minutes Number Enter the interval for which you will schedule this bot to run when you deploy it (minimum 2 min,maximum 30 min)
    Average_Pages Average number of pages per document Enter the approximate average number of pages in the documents
    FilesInFolder Holds file name and extension Dictionary --
    SourcePath File path to the folder containing documents awaiting upload to Automatización de documentos String Enter the file path
    OutputPath File path to the folder containing the extracted data and invalid or failed documents String Enter the file path where you want the extraction output
  4. Insert a Loop acción to iterate through all the documents in a specific file path.
    1. Double-click or drag the Loop acción.
    2. Select the For each file in folder iterator.
    3. Insert the SourcePath variable into the Folder path field.
    4. Insert the FilesInFolder variable into the Assign file name and extension to this variable field.
  5. Insert an If acción to compare the number of documents uploaded for processing to the number of Bot Runner devices multiplied by a scheduling interval and divided by the average number of pages.
    Nota: You must include this equation to limit the number of files uploaded for processing at one time to ensure that the Instancias de Bot Runner are able to process the documents.
    1. Drag the If acción into the Loop container.
    2. Select the Number condition.
    3. Insert the File_Count variable into the Source value field.
    4. Select the Less than operator.
    5. Enter the following into the Target value field: $Extraction_DeviceCount$*$Scheduler_Interval$/$Average_Pages$
  6. Insert If: Else and Loop: Break acciones to end the loop if the condition is not met:
    1. Drag the If: Else acción beside the If acción in the Loop container.
    2. Drag the Loop: Break acción into the If: Else container.
  7. Insert an error handling mechanism to log any possible errors:
    1. Drag the Error handler: Try acción into the If container.
    2. Drag the Error handler: Catch acción beside the Error handler: Try acción.
    3. Drag a Delay acción below the Error handler: Catch acción.
    4. Set a delay of 10 seconds.
  8. Configure acciones to upload documents to the process associated with a specific learning instance.
    1. Drag the Process Composer: Create a request acción below the Error handler: Try acción.
      Nota: You are pointing to a public process path that Automatización de documentos creates automatically. For example, see the following image:
      Process-Composer-Public-Processor
    2. Mark the Set LearningInstanceName option and provide the name of the learning instance where to send the documents.
    3. Mark the Set InputFile option and enter $SourcePath$/$FilesInFolder{name}$.$FilesInFolder{extension}$.
    4. Mark the Set InputFileName option and enter $FilesInFolder{name}$.$FilesInFolder{extension}$.
    5. Mark the Set OutputFolder option and enter $OutputPath$.
    6. Drag the Number: Increment acción below the Process Composer: Create a request acción.
    7. Insert the File_Count variable into the Number and Assign output to variable fields.
      The Number acción increases the value of File_Count by one each time a file is uploaded to the learning instance. As long as the value in File_Count is less than the total in the equation you entered in step 5, the bot can run another loop iteration to upload another document to the learning instance.
  9. Make a copy of the uploaded file to a different location on your desktop to keep track of which documents were successfully uploaded:
    1. Drag the File: Copy Desktop file acción below the Number: Increment acción.
    2. Enter $SourcePath$/$FilesInFolder{name}$.$FilesInFolder{extension}$ in the Source file field.
    3. Provide the folder path where to copy the files.
  10. Remove documents after they are uploaded to Automatización de documentos so they do not get re-uploaded in the next iteration:
    1. Drag the File: Delete acción.
    2. Enter $SourcePath$/$FilesInFolder{name}$.$FilesInFolder{extension}$ in the File field.
  11. Click Save.

The completed bot should resemble the one in the image below:

Screenshot of completed bot

Qué hacer a continuación

Publish the process and bot. See step 3 of Publicar la instancia de aprendizaje en producción