Process data in multiple folder

Hello guys,

image

I have read the Data excel which is containing data of folder names “21.02.2024”
and “22.02.2024” like this below

image

  1. First it will take 21.02.2024 from data excel and check whether a folder named “21.02.2024”
    So here the folder exist so RPA will process the excel inside the folder “21.02.2024”

This is the excel inside the "21.02.2024 " folder

So after processing it will go to the end process and move the “21.02.2024” to archive folder and give remark like “completed” in Data excel.

So the above process is working fine

So now after end process it is going back to initial state

and it should check for “22.02.2024” folder available or not if available it should process that folder in similar way. instead of that it is picking the same folder “21.02.2024” which is already processed and moved to archive

The reframework is made like this

image

So after folder one processed it is moved to archive and it is going to the initial state but it is not picking the “22.02.2024” folder instead it is picking the same folder which is already processed and moved to archive that is “21.02.2024”.

Hello @Gokul_Murali

Consider your data in excel as transactions and pass it through the get transaction state.

In Process state, for each transaction check if the folder exists with the path exists activity.
If the folder exists, loop through the files in the folder.

create a variable of type(System.String) and in the value give as Directory.GetFiles(“FolderPath”)

This will give you the excels in the folder and you can loop through each of them using for each.

In the next transaction, it will pick the next folder again and so on…

I implore you to get away from REFramework for automations like this. It’s unnecessary complexity and overhead. This is a very simple automation to just write from scratch. In fact, I never use REFramework. It’s a mess. Over time we’ve built our own template - based on the UiPath Transactional Process template. You might not even be aware there are tons of other templates besides REFramework.

See this is a sample process to get the solution,
After getting solution i have to shift this Code to other Reframework process which is a massive code already in production.

So if i change the code in production only for this that will consume a huge time for me to change the entire code

so it is passed as a transaction data and checking for folder also and it will processing the first folder,

After first folder is completed it is going again to the initial state but it is not taking the second folder instead it is taking the same folder which is already processed.

@Gokul_Murali

  1. After successful processing of first it should go to get transaction data…if it is going to itialize means there might be some failure
  2. Show you get transaction data as that is where you would set the transactionitem and your transaction item should be set properly for it to work

cheers

I have changed the REframework condition in the end process.

So after completing the first folder it will come to the end process and move the processed folder to archive.

Then again it will go to the init state to check whether there is any folder to process or not if folder exist it will read the excel from that folder in the init state and should proceed.

So transition T1 will pointed to init state so after first folder it will goto the init state again to check folder any other folder exist or not

image

@Gokul_Murali

What is the condition that you have given?

and if you loop this way where did you give the end condition

cheers

In T1 transition - If transaction item is nothing it should goto init state and is going to the init state as per the given condition.

But the issue is that when coming to init state after processing the first folder it should take the second folder, instead of that it is taking the first folder again.

To end the process i have given a condition in the end process itself

That is if there is no folder available for process it should terminate

@Gokul_Murali

What is the condition you are using in init state to say that it should take second folder now

and if transation item itself is null then what are you using?

why are you trying to complicate it…when you already have the available loop for you

the only thign you need to do is…change transactionitem to string to assign the required path and in init state if first run use directory.GetDirectories("BaseFolder") and save it to a list of string variable

then in get transactiondata use if condition with in_transactionnumber <= listvar.Count then out_transactionitem = listvar(in_transactionnumber-1) on else sisde assign with nothing

cheers

@Anil_G

Please help me out on this scenario

@Gokul_Murali

Please check my previous comment

cheers