Get Transaction Item in Reframework

Hi all,
I have a scenario, where I need to perform some steps on each file…
so Transaction item would be Filename…
I need to loop through each file in a folder-- from get transaction i should get one file at a time.

Please help on this

Thanks

Hi @MEGHA_cs

You can try with Get Queue item and then use the output in for each and loop them there by this no transaction will go to inprogress

Regards
Sudharsan

Thanks.
but I dont have Orchestrator

Ohh You are using the transaction item as Datarow?

If yes what you can do is

You will be reading the input file right below that keep for each row in datatable and loop through it and do you pre requisite steps

After that looping it will start with the actual transaction steps

Regards
Sudharsan

Hi @MEGHA_cs - Try the below steps

  • In initialization, read the files from the folder, store in a variable
(Variable of type Array Of Strings) Files = Directory.GetFiles("YourFolderPath")
  • In Get Transaction Data, take another variable FileName (String type), Index(int type, default value set to 0). If Index is 0 it gets the first file name, 1 second file name…
  • Within assign activity, use below exp. Enclose the assign activity in a Try Catch block so that when there were no files to retrieve, it throws an exception. Handle that exception and stops the process.
(Variable of type String) FileName = Files(Index)
  • Now, you can use the FileName variable in the Process Transaction State. Finally, increment the index variable before going to Get Transaction Data. The process repeats.

Thanks,
but can you please explain, what would be transaction item

@MEGHA_cs

1, Modify the transaction item to string from queue item and change io_Transactiondata to Array(Of String) from datatable
2. In get transaction data remove get transaction item and add if condition with in_TransactionNumber=1 then side use directory.GetFiles("Folderpath") and assign it to io_Transactiondata
3. Add one more if condition with in_TransactionNumber <= io_Transactiondata.Count…Then side use out_TransactioNitem = io_TransactioNData(in_TransactionNumber-1) and on else side assign out_TransactioNitem = Nothing

Hope this helps

cheers

Thanks, but am getting this error
Retry Get transaction item: Object reference not set to an instance of an object.

I have change Transaction item to string Datatype in all states right?

@MEGHA_cs

Please delete get tranasaction item activity only…you dont need it

And the error says something is null

Yes you have to change to string wverywhere

Cheers

Thanks, its working

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.