Currently I have 3 different type of files that start with “AB”,“CD” and “55” pdf file that I would like to use different flows accordingly.
E.g file start with “AB” I would like to use flow 1;
File start with “CD” I would like to use flow 2;
File start with “55” I would like to use flow 3.
I think I can use if moduel in UiPath but I don’t know what kind of input I should key in to do this path selection.What should I do in UiPath to make this happen?
HI,
How about using regex and Switch as the following?
System.Text.RegularExpressions.Regex.Match(CurrentFile.Name,"^(AB|CD|55)").Value
Regards,
We would recommend to use the switch activity for it
You can use For Each File in A folder to iterate through the files in a folder & Use
CurrentFile.Name.StartsWith(“AA”)
For Selecting the Flow In Else If Codition if the File Name Starts with (“AA”) or (“CD”) You can add multiple Else if conditions for different flows
I can’t run this code due to the option strict on disallows implicit conversions from ‘String’ to ‘Integer’. I think I may need to use other ways
HI,
Can you try to set String at TypeArgument property of Switch?
Regards,
I also would like to do page count in this period. Is ther any possibility that we use Get PDF Page Count directly or we need to use another for each loop?
Hi,
Can you elaborate? If you need number of pages in the PDF file, the following will work.
Regards,
Hello Yoichi:
Currently I have already created a for each loop to read pdf files in the path. However, just read the file is not enough, I would like to also know the number of pages before I move to next step since I need the number of pages to repeat the flow certain times according to # of pages. That which lead to my quesiton:
Is there anyway to write codes in “Get PDF Page Count” moduel to read files in fixed paths start with “94”? Or I need some other ways to to make it.
Hi,
If you use ForEachFileInFolder activity, CurrentFile.FullName returns file name with full path.
So, the following GetPDFPageCount returns number of pages.
We can put it anywhere inside ForEachFileInFolder.
Regards,
Thank you very much, it works!
Best,
This is where your if condition comes into picture.
Step 1: Use for each file in a folder
Step 2: Use if to differentiate the file starts with condition of yours
Step 3: Inside the if condition you will only get file which start with your condition like(AA, BB)
Step 4: Use the Get pdf page count inside this if with CurrentFile.FullName it will give you count of that already filtered file from If condition.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.