Try Catch and Next Value

Hi

Please see my screenshot. I’m taking Document No. values from my excel spreadsheet and inputting it into SAP Document No. field. Sometimes the values aren’t found, so it needs to move onto the next Document No. in my excel spreadsheet to input. Can someone tell how to reference the next cell in an excel spreadsheet, within a Try/Catch activity?

My catch function has the three activities repeated from the Try function, but I need it to go to the next one.

Why do you use TryCatch to deal with a predictable error?

In the Try block you must validate the existence of a value in “DocumentNos” column and other ones. If it meets put values on SAP else pass next row.

ElementExists activity can detect if selector exist or not.

1 Like

@neeta.joji

Welcome to our UiPath community.

You should keep entering document number flow inside Try block but not Catch block. Follow below steps.

  1. Use ForEach Row activity to iterate one by one row.
  2. Inside ForEach Row activity, use Try Catch block and keep document number entering flow inside Try block and then check document exists in SAP or not. If it is exists continue with the next steps else throw the exception. In Catch block, log the message like document exists.

In this way, Bot will go to next record in the input file if current record doesn’t exists.

1 Like

I appreciate yall’s responses, thank you!

1 Like

Hi,

So i tried the try/catch within the ForEachRow activity, however once it encounters an incorrect document number, it stops because its trying to continue the process. It needs to try the next number in the excel spreadsheet and if its valid move to the next step to take a screenshot of the next page that opens.

I tried putting the screenshot sequence outside of the ForEachRow activity, then all it does is keep trying documents numbers in each row without proceeding with the rest of the steps for the successful document numbers. Any ideas what to do here? Please see my attachment

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