Hello i have a for each loop. That goes through a folder of a bunch of pdf files. Then it does something with it. How can i perfrom it so when it goes thorugh the file and perfrom the action. If the action failes, then it shall move to next file, then so on
Put the action into the Try/Catch block
here are the steps:
- Use Directory.GetFIles(Path) to get all the files in the folder…
- Use for each loop to loop through all the files
- Within for each loop, do all the things you need
- To skip if fails, try usinf TRY CATCH activities inside the for each loop
the action its pretty deep into the code structure, would it be able to jump all the way out and start over ? or will it just skip it ?
Do you use orchestrator and the RE Framework? If so, it’s easy
- In the Init phase, Use Directory.GetFiles(Filepath) to get all the files in the folder
- Upload each file name (with full filepath) to orchestrator
- In Get Transaction Data phase, get the full filepath of the next item
- In the Process phase, do whatever you need to with the file then move onto the next one
The RE Framework can handle unknown exceptions and retry the transaction item and you can program in business exceptions where applicable.
Have you tried these @langsem
Not yet, not sure what to put in the try catch ?
As you need to continue when the pdf fails, so we need to use Try catch
so in the try block, i will use a loop again ?
In the loop itself, use try catch for all the activities so that, if one fails, it will move to another activity.
thats inside the loop. Inside the loop i have several actions. inside those actions there are some if else statements, i want it to start from beginning with a new file when the if statement its wrong
Just use TRY CATCH and put all the IF condition inside it
think it would crash then, The actions its very big and splitted into different workflows.
No problem, try it
did not work, its because its different workflows, actions its performed late and early in the code etc.
- Use Assign activity to read all files from folder (where PDF files are), put them in a String Array
- Use For Each activity to loop through PDF files
- In the For Each activity use Try/Catch Activity. Put the action that you want to do to the PDF file in Try block, and in Catch block put action that you want to be preformed when an exception occurs (when action fails) so for your case, just go to next file
Hm think i need to send the xml to make better understanding. Dont think its capeable of putting everything in a try block since the file its so big