Move files to Rejected folder upon error

Hello,

I have a process that loops through a local folder and imports excel files into a SQL database.

During the loop the excel file are moved from a INPUT folder to a ARCHIVE folder.

Can someone help me move the excel file from the INPUT folder to a REJECTED folder if there is an error. AND continue the Loop through other files.

Any help and direction would be appreciated.

Thanks,

Tim

Hi @timothy.mullady !
To move a file, i suggest you to use “Move file” activity
What is the error that you are expecting ? A system error (for instance when reading the file does not succeed)or business error (if the file does not fill the requirement then it is considered as an error) ?

@timothy.mullady

As @Hiba_B suggested use Move File Activity

If error is happening like file not exist then use PathExists activity, some thing else then use surround the activity with Try Catch

Hope this may help you

Thanks

common errors would be the tab name is different or header name different.

Really any error with read range or SQL insert

@timothy.mullady

So for those activities you surround With Try Catch Activity and in catch specify the error and place the move File activity.

If you are using Re-Framework then you can make a move File activity inside System Exception

Hope this may help you

Thanks

1 Like

Exactly as @ksrinu070184 said, here is an illustrated exampleerror_handling
Drag&drop try catch activity, put inside the activities that may bring an error (separate try catch for read range AND sql insert) + move to successful folder
Then chose exception type for “add new catch” option, and add move to error folder

Could I do a catch on the entire work flow? To handle either a read range or SQL insert error?

For each Item in Array_Files

Yes of course, i suggested the separate try catch in case you want to differenciate the paths of the error folder