can i use a datarow to store a file path of each sub directory in a main folder ? Each sub directory represents an application to be submitted. In each sub directory there will be a few files where the application needs to be supported with. how do i loop through each application correctly and process the required items?
There are two options. You can either get all files under a particular file path (includes sub folders as well) and loop through the list. Or else you can get a list of files under a particular folder structure and loop through it.
Refer this link to get the list of files or folders
Once you get it, you can use a For each loop to loop through the files/ folders to access your files to process
As a note: i dont think you need a data row to handle this. It can be done through arrays easily as in the attached topic
Hope it helps!!
Let know how it goes for you…
but i would need it to pass to different states to check if transaction item is nothing or not nothing
If thats the case, you do something like this. Once the array is ready by above steps, you can add the array items to a datatable variable using the Add Data Row activity. This will give you a datatable which you can take a datarow at a time and check for your condition without a problem
Refer my below post to add items to a datatable using add data row activity. It will help you to get it sortes
Let know how it goes…
Will this work?
Using part of the ReFramework template for the gathering of data and processing, i used Directory.GetDirectories to retrieve all the different sub folders inside the main folder, as each folder represents a unique application to submit.
Each directory in the loop would be added into a List of string with a counter (in the end the string list contains a list of file paths to each sub folder in the main folder). Then, an if loop to check if transaction number is less than the List.count, with the then activity assigning the out_TransactionItem to be List(in_TransactionNumber) and else activity assigning the out_TransactionItem to be nothing.
It will then continue on to the state transition to check if TransactionItem is or isNot nothing, supposedly it has items, it will continue on to the next state to process and at the end of the process it will increment the TransactionNumber and will it loop correctly?
Sorry for my late reply… so you are using the framework. As i understood this is what you have done.
In the init state you have added the list of directories to a list variable. This also includes the file name as well.
And you are passing the list to get transaction data. There using the transaction number you take one item from the list to do your processing and assign it to out_transactionitem. And this happens while transaction number is < list.count.
In the state validations you check whether its nothing or not.
So… this approach looks great bro!!! i dont see any issue with it. You can continue without an issue
Hope it helps!!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.