Reporting the processed invoices during automation process

Hey

I am doing an exercise where the purpose is to automate the processing of invoices. At the end of the process, a report should be made showing successful and unsuccessful invoice processing, in short, it should show how many were automatically processed and how many were not.

The report should be created using Sequence, however, I don’t understand how to do this… Also, counters(variables) should be used.

Hello @MJS, try following this flow:

  1. Initialize Counters: Create two Integer variables to count the successful and unsuccessful invoice processing. Let’s name them SuccessCount and FailureCount. Set both to 0 at the beginning.

  2. Process Invoices: Inside your main workflow, iterate through the invoices. For each invoice:

  • Process the invoice.
  • If the processing is successful, increment the SuccessCount variable by 1.
  • If the processing fails, increment the FailureCount variable by 1.Example (pseudo-code):
For Each invoice In Invoices
    If ProcessInvoice(invoice) Then
        SuccessCount = SuccessCount + 1
    Else
        FailureCount = FailureCount + 1
    End If
Next
  1. Create Report: After processing all invoices, you can create a report using a Sequence. Inside this Sequence:
  • Use Log Message activities to display the counts.
  • Construct a message that summarizes the processing results, like “Successfully processed: X invoices, Failed: Y invoices.”
  • You can also write this message to a log file or Excel for a more formal report.Example:
Log Message: "Successfully processed: " + SuccessCount.ToString + " invoices, Failed: " + FailureCount.ToString + " invoices."
  1. End of Process: Continue with any other actions you need to perform at the end of your automation process.

This way, you’re keeping track of successful and unsuccessful invoice processing using the SuccessCount and FailureCount variables and creating a report at the end to summarize the results.

Hope it helps, cheers! :slight_smile:

Hi @MJS

Greetings buddy!

If you need a report for the same, you can increment counters of pass and fail and write them in a mail or an attached excel file.

If you need more granular details such as which invoices passed and which failed.
You can create a datatable and pass it in/out into your process workflow in REFramework, or wherever you get the details of the the invoice numbers that you need to process,

loop through the datatable using a while loop and a counter and update the status of row in the end if process completes and invoice processing is completed for one item, or if it exceptions out.

This way, you’ll have more details as in which items failed and which didn’t along with the reasons of failure using business exceptions.

Thanks :smiley:
Happy Automation!

Hi @MJS

Certainly! To create a report in UiPath that summarizes the successful and unsuccessful invoice processing using sequences and counters (variables), follow these steps:

  1. Initialize Counters:

    • Create two integer variables, e.g., SuccessfulCount and UnsuccessfulCount, and set their initial values to 0. These variables will be used to count successful and unsuccessful invoice processing.
  2. Processing Invoices:

    • Use a loop, like a “For Each” activity, to iterate through your list of invoices.

    • Within the loop, implement the logic to process each invoice. At the end of the processing logic for each invoice, determine whether it was processed successfully or not.

    • If an invoice is successfully processed, increment the SuccessfulCount variable by 1.

    • If an invoice is not successfully processed, increment the UnsuccessfulCount variable by 1.

  3. Generate the Report:

    • After processing all invoices, create a sequence to generate the report.

    • Use a “Message Box” activity or “Write Line” activity to display a report message, which includes the counts of successful and unsuccessful invoices. For example:

      "Total Invoices Processed: " + (SuccessfulCount + UnsuccessfulCount).ToString()
      "Successful Invoices Processed: " + SuccessfulCount.ToString()
      "Unsuccessful Invoices: " + UnsuccessfulCount.ToString()
      
  4. Save the Report (Optional):

    • If you want to save the report to a file (e.g., a text file or Excel sheet), you can use the appropriate activities for that purpose, such as “Write Text File” or “Write Range” (for Excel).

Thanks!!

Hey

Thanks everyone for the great answers. Unfortunately, I can’t get the IF clause to work, it keeps asking for parentheses and says that due to the strict on mode, I can’t change the variable type.

I could elaborate a bit on my question from yesterday.

The need is to make the successful and failed processes appear in the Output view as text. So I can create new variables in Int32 format, but I can’t get the IF condition to work

Hi @MJS

Did you achieve the report generation for the processed invoices.