Log status based on error in CurrentRow

Hi UiPath forum

I am trying to create a work-flow in a Try/Catch environment. The workflow in itself is working formidably, however the nature of the tasks it automates does unfortunately result in errors.

I really want to make the workflow output a message in a new column, based on whether or not it is a Try or Catch. If no errors were detected, it should output “Processed”, and if errors were detected, it should write “Need Review”. I simply cannot make it work.

Thanks in advance for any help.

Kind regards,
Aksel

The current work-flow is:

Read Range (Excel File)
Add Column to DataTable (Status)
For Each Row → Try(The task it has to do) → Catch(Nothing yet, as I do not know how to write to the specific row in the specific column)
Output datatable

@arasm17

Welcome to our UiPath community.

  1. First add one new column called Status to the input file.

  2. Use For Each Row activity to process one by one item.

  3. Keep the processing of that part in Try block. At the end write status as below.

            row("Status") = "Processed"
    
  4. If any exception occurred while processing the item then it will go to the Catch block. Here update the status as below.

           row("Status") = "Needs Review"
    
  5. At the end of loop, use Write Range activity and pass above DataTable to write back into the excel file.

Hi @lakshman

Thanks.

This is exactly how it is setup right now. Only, I have to add the column “Status” through UiPath Add Data Column, as it needs to be added every single time.

How do I write the status? Like, what activity do I use?

Again, thanks. Sorry if I am a bit clueless.

@arasm17

  1. First use Read Range activity to read the Data from Excel file and it will give output as DataTable. Let’s say dtInput.

  2. And then use Add DataColumn activity to add new column called Status to the DataTable dtInput.

Use Assign activity and pass above expression to update the status for each row.

It worked. Thanks!

Another issue was that I used CurrentRow in my loop, so that when I need to reference the row it was CurrentRow(“Status”) = “Processed”.

Thank you so much!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.