How to compare a variable of previous transaction with the current transaction


I have a variable called ID , i want to compare this with the current transaction ID
If the ID is different then create a new file with that ID name
ID’s are (2,2,3,4,5,5,6,7,7)

so when it gets new value then it has to create a new file.

Hi @Deeksha

If you are trying to check if id is present in the list of id’s then use ID.Contains() use this in if condition


Hi @Anil_G

I am not checking if its present or not.

using get transaction item i am fetching the ID
I have to differentiate if the previous transaction ID is same as to the current transaction ID


In order to do this, create a global variable (in Main) and right before you get a new transaction in GetTransactionData save the previous transaction ID in this variable.

This is the easiest way of doing this that I know of.

Best of luck

Hi @Deeksha

If you need to check only one previous ID then use Global variable

Else if you need to check with all ids then add the values to asset using set asset and using get asset get the values always. After get asset before setting the asset again use assign activity to append the new id to previous id

str = str + New ID


hi @Laurentiu_Mihai

How to save the last transaction , can you please explain a bit more

HI @Deeksha

In your process as the last step add the value of transaction ID to the global variable created which can be used further


Hi, sure.

  1. Go into the framework and open the ‘Get Transaction Data’

  2. Create an ‘If’ activity like in the screenshot below, with the following condition: TransactionID isNot Nothing andAlso TransactionID <> String.Empty

  3. Inside the ‘If’ condition, on the ‘Then’ side, add an ‘Assign’ activity. On the left side of the ‘Assign’, create your ‘previousTransactionID’ variable (using Ctrl+K). On the right side put the TransactionID variable.

  4. Change the scope of ‘previousTransactionID’ in order for it to be global, such in the screenshot below:

Hope this helps, let me know if you have any questions.

Then you’ll have to store that previous ID value in a variable before moving to the next transaction, so you then have the value to compare.

Note that you’ll have to account for when you’re on the very first transaction so there is no previous transaction.

But in general this sounds like maybe not the best way to accomplish your goal. Can you give us more detail about your process and why you want to look at the previous ID?

1 Like

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