Iterate Through Folders in REFramework

Hi Guys,

I have One Folder called ‘EmployeeDocs’ and in that Subfolders are there. so i want that Subfolders as Transaction Item in REFramework, so how can I do it?
image
image

Can it work by Environment.GetFolderPath or Directory.GetFiles?

@kuldeep.shinde

Use " For Each Folder in Folder"
Try with this “Directory.GetFiles”

Thank you @Manju_Reddy_Kanughula for your Reply, you are correct but i want to do it in REFramework in ‘Get Transaction Item’ as it will pick each subfolder as a Transaction Item.

In that case you have two options

  1. Add a “Dispatcher Sequence” in Init block of REF (more specifically inside First Run sequence)
    image

  2. Create a separate Dispatcher procees to add queue items

@kuldeep.shinde

You can do that by using directory.Getdirectories method…

In your get transaction data xamlwuse if condition with transactionnumber-=1 then get the sub directories using above method…

Then change transaction data to array if strings and transaction item to string…

Then use arr(transactionnumber-1) to get all folders one after the other…

Till transactionumber <= arr.count

Arr being the output if directory.getdirectories

Hope this helps

Cheers

Yes @Anil_G it works:) now i want to select the folder according to the folder mentioned in the web if suppose ‘BDNA15515’ is showed on web then it select that folder. so how can we do it?

@kuldeep.shinde

Before these getdirectories step…use a get text activity to get the value from web and use that as the folder or append that folder name to the fullpath you need

Add this in the same if condition of transactionnumber = 1

Cheers

yeah i did like below
image


image

get the folder name from web and then checking if that directories contain that folder if yes then assign it to the transaction item. is it correct?

@kuldeep.shinde

I am lost on what you are doing…

I believe io_Arrs_folders ia an array…array can be accessed by using index not some string that you gave… io_arr_folders(0)

Or if you want to select only the identified folder as you used contains you can use

io_arr_folders.where(function(x) x.contains("whatever you gave in if"))(0) will give you that particular folder

Cheers