How to loop at a list of files


#1

Hi
Can anyone give a hint to a newbie how to loop at a list of files in RPAx? I have some 400 PDF files to process, sometimes more and sometimes less, each one is processed the same way but I don’t know how to define the loop on that list. Probably using some S3 functionality but that activity is not available in RPAx.

Thanks for your help!


#2

Hi, its not required to loop all files in single execution. I have recommendations to process single file and then you can create simple business process in Workfusion where the first step will read all files and split them into single record and then each record with single file will be processed separately. First step 1 come in , 400 come out. Second step one come in and one come out, so you will do processing for single file.


#3

@timriewe
There is a local S3 File Storage installed with RPA Express
More information about it you can find here https://kb.workfusion.com/display/RPAe/S3+File+Storage

Note: The current version 1.1.0 does not support OCR for PDF, but for image files only. Keep this information in mind, if you are going to do OCR for PDF.


Using OCR for reading PDF
#4

@timriewe - you can record how you access your file list in a standard way;

Then you can add a loop where you navigate through this file list using keyboard (Arrow down, Enter, do something, close)


#5

Thanks ahlushkou for the hint, but I am afraid I dont understand it.

What do you mean by that?


#6

azinchukAdministrator4h
@timriewe - you can record how you access your file list in a standard way;

Then you can add a loop where you navigate through this file list using keyboard (Arrow down, Enter, do something, close)

Yes, thats how I was doiing it in the end but I thought there would be a more elegant way to do it. Anyway, how do I define the loop? What is the criteria to exit from that loop?


#7

Hi amashentsev

yes, I saw that S3 can be opened and accessed fro the Control Panel. But not from the RPA recorder. The actions are there but greyed out. Can I not use a file stored in S3 from the RPA Recorder?

The PDFs I use are “searchable” PDF, so no OCR required. I search for a specific tiopic withn in them and then select and copy a value that is next to that term. So no problem for OCR here.


#8

Hello
I have the same concern : how do you determine the number of files so you know how many times to do the “Arrow Down / Enter / Do something” ?


#9

The only way I found is counting the files (manually!) and loop that many times at the list of files. Not very elegant…


#10

Hey,

There is probably a better way to do it but here is how I managed to do it using the Windows “Copy as Path” context menu:
On the Explorer Window that contains the files you want to work on:

  1. Enter Keystrokes (Ctrl+a) [Selects all files]
  2. Enter Keystrokes (Shift + Context Menu) [Opens the context menu]
  3. Enter Keystrokes (a) [Makes a copy of all file names with their full path]
  4. Clipboard (to ‘list’) [Puts all the individual file paths on a list]

Then just iterate through the list with whatever process you require.

Hope this helps.


#11

Excellent, thanks @Humberto_Zuniga!
For those who dont have a context menu key on their keyboard (like me…) you can use SHIFT-F10


#12

Hi @Humberto_Zuniga, maybe you can help on this one, too. I cannot get my list variable filled with the list of file paths.

My variable “filelist” only takes the first line.

Any idea what I am doiing wrong?
Thanks!


#13

Hey @timriewe,

I had to use the Linux/MacOS line break (LF) as separators to get my list to populate correctly.

Regards


#14

@timriewe
In “Recorder Variables” section add elements to your list variable, that is used

In this case, we need to know the exact list/table size


#15

Hi @mzhalniarkevich, yes but this works as you say only for static lists. My list changes in length. Besides in that screen one has to insert the items one by one. Cannot copy the whole list into it.


#16

@Humberto_Zuniga, did you define any separators? I am missing “row separators” in the definition box. there is only the option of coloumn separators, which doesn´t make much sense in a one-coloumnn list.

my list with the copied file paths appears like this in the clipboard:
“C:\Users\dell\Google Drive\RLCs\RLC_MAYO DE 2017 1.pdf”
“C:\Users\dell\Google Drive\RLCs\RLC_MAYO DE 2017 2.pdf”
“C:\Users\dell\Google Drive\RLCs\RLC_MAYO DE 2017 3.pdf”

But in “test settings” only the first item shows up in the filelist variable. I tried Linux/MacOS line break (LF) as well, although I am on Windows. Also didnt work.


#17

Hey @timriewe,

Here’s my setup along with a for loop that I used to test the list:

The expression is just a counter that I increment with each cycle of the loop:

${iterator}+1

Important to note that I did not check the test settings.


#18

In that case, you can

  1. create a loop
  2. Add value you need to string
  3. Append this string to list
  4. repeat

In that case you dont need to know the list size beforehand


#19

@Humberto_Zuniga, looks like I use the same settings, only for Windows and not for Mac/Linux. But the list doesn´t show up.
In your action list I think there is a “Enter keystrokes (ENTER)” missing after the “Enter keystrokes (a)”. At least in mine I need it to copy all the file paths to the clipboard. And I think the iteration calculation is not needed when you say “for each item in list”. It automatically takes the next item when one loop is finished.

I will try some more to get my copied list into the variable.


#20

You are right on the calculation not being needed for the loop. I added it so I could “print it” on notepad with each cycle and ensure that the cycle completed properly. Good luck with your testing @timriewe