I have built a Flowchart, which selects multiple PDF Files inside a folder and it checks if it fulfills the condition or not.
Therefore, I have taken the word “Machine A” and “Machine B”, these will be counted and saved inside the variables (“Machine A” = wordCountA ; “Machine B” = wordCountB)
Now I want to fulfill the condition that the word count of Machine A is equal or greater than
Machine B, and if the condition succeeds, the result will be listed on an Excel File.
Therefore I would like to add an if activity or Flow decision with the condition:
"wordCountA >= wordCountB ".
Ok now I get it better.
So the right condition for you in the if statement is the following: wordCountA.Count >= wordCountB.Count
No conversion needed here
Because matches return an IEnumerable as you have seen, you can’t apply an operation on IEnumerable (being it + or - or / or x or > or < etc). But what you want to compare is the number of occurences, and the number of occurences = number of elements returned by matches = number of elements stocked in your IEnumerable variables.
And to have access to the number of elements stocked in your IEnumerable, you just need to add .Count and voilà
thank you very much for the detailed explanation, the error is gone and it worked .
I just finished the project and came to another error, maybe you can help me with that too.
While I have a For Each Loop, which checks throw multiple pdf files in a folder (like described above) I get a For Each: Could not find a part of the path error.
Great that the solution fits you !
For your error, there are many sources of errors. To understand better, would you mind running in debug mode your code ? Then copy/paste your whole UiPath Studio screen once the error happens. What we need to see is the variable panel
Then we need to see that panel, that’s what you need to screenshot us + the remote exception that it throws
Alright, thank you.
When you open any windows explorer and copy paste the following path then hit enter, does Windows return an error ? Or does Windows redirect you to the directory level ? C:\Users\okan9\Dokumente\UiPath\BA_2\List
and drag & drop assign to have my_arr = Directory.GetFiles(PfadPDF)
Then in your foreach, instead of putting Directory.GetFiles(PfadPDF) replace it by my_arr.
Then debug your code and screenshot us again the result: we would like to see what are the elements returned by the robot as a local variable for my_arr
@Okan it’s normal that my_arr has the error, but what we would like to see is what is fetched inside my_arr variable (the local panel on the top left) with a screenshot.
Also, would you mind sending us a screenshot of what you see on windows explorer when you write the path C:\Users\okan9\Dokumente\UiPath\BA_2\List and hit enter in windows explorer ? You can make the files blurry but we need at least to see the A.pdf inside
This folder has around 100 pdf files in it. The PDF File A is more of a test.
I also tried this with having only one file in the folder, still the same error.