Good morning friends:
One query please, I would like to detect parts of words with regex, then make a conditional to make a copy of that file to a path.
But in the if, it does not allow me to use several “or”, it seems to me that on other occasions I have been able to use them, but I am not sure.
Another form of filter that I would like to try is from the creation of the array. For example, in the image the file names have to contain the word “Received” but not the word tmp. In this thing, how do I add more words apart from “Inbox”, I would also like to add “KREDI” or other words, like in the first image.
One file is Received_GEN_ KREDI EN 15.03.xlsx
Finally, here inside can i use regex??
“Directory.GetFiles(folderDownload,“Received”).Where(Function(w) Not (Path.GetFileNameWithoutExtension(w).ToLower.Contains(“tmp”))).ToArray()”
@Lynx In the if you were using filesEsUrEc= which represents boolean format, so it was showing that error
Since that variable is a string you have to mention the condition like below
filesEsUrEc.equals(“ABC”) or filesEsUrEc.equals(“BBC”)
@Lynx This means filesEsUrEc variable has null value. Can you print this value using message box before if
I deleted the “try catch” and created it again, now it progresses but in the if, the error appears in the if:
@Lynx When an exception comes at Assign activity (highlighted one) the bot was handling that exception by switching to the catch block (You can also test by keeping some message box in the catch block to check whether bot entering into that block or not).
Later that it was trying to execute the if where you are getting different exception since the variable value was empty
Do you want to continue the process still the bot encounters this exception or do you want to continue with the next file ?
Sure, I want it to continue with the next file to see if it meets the filter.
Why will this error come out?
@Lynx Yes, it was showing that exception since that variable was empty. If you want to handle this then you can add another condition in the If activity like below
or If you want to continue with the next file then the complete code with in the for each has to be put in a Try Catch. This way the bot switches to the catch block if any exception comes and it loops back to the next file. Please find below sample workflow for better understanding
looping.zip (3.1 KB)
I put a “try catch” in the “if” and it works
@Lynx yes, you can use individual try catch or single try catch for the entire logic within for each
Thank you very much @ushu for your help
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.