How to get Previous Transaction data

Hello guys,

I have an excel i want to compare the new transaction data with old transaction data.

image

Example :-1:

If RPA move to the 2nd row it should compare the first policy number with 2nd policy number.

Hi @Gokul_Murali

Initialize two variables as Input and Output and then use the for each row in data table and within the for each row in data table use the assign activity and assign the current row value to the input variable and later check the input and output variables by using If condition and give the conditions as per your requirement and after the if condition use the assign activity and assign the input value to the output variable. It helps to check the Current value with the previous value. Please check the below attached workflow sequence for better understanding.

Regards

@Gokul_Murali

you can store that to a variable and you can compare

or if you are using in reframework

you can compare the old transaction data with new transaction data

use if condition

in_TransactionNumber>=1

TransactionItem(in_TransactionNumber).tostring=TransactionItem(in_TransactionNumber-1).tostring

here TransactionItem is of Type DataRow

@Shiva_Nikhil
@vrdabberu

Let me check both cases and ill update you

1 Like

@Gokul_Murali

in my scenarion in_TransactionNumber should start from zero

and in the process state you need to create an argument as in_TransactionNumber and map it with
the TransactionNumber

@Gokul_Murali

As you are using the Transaction Data please try saving the Transaction Data into input and later assign that data to Output and proceed the remaining flow as same.

Regards

Hello @Gokul_Murali
End of the Loop, assign the currentRow(“PolicyNumber”)
it will carry the same data in the next Row loop.

@Gokul_Murali

Compare and do what?

You can do so by using

For each row in datatable and in properties there is an index property assign a integer variable to it

Use if condition if index=0 on then side do nothing as this is the first row

On else side you can compare like this currentRow("PolicyNumber").ToString.Equals(dt.Rows(index-1)("PolicyNumber").ToString)

Cheers

Hi @Gokul_Murali

  • Excel Application Scope
    • Read Range to dtPolicy
  • Assign activity: intRowIndex = 0
  • For Each Row in dtPolicy
    • If intRowIndex > 0 Then
      • Assign activity: strPreviousPolicy = dtPolicy.Rows(intRowIndex-1)(“Policy Number”).ToString
      • Assign activity: strCurrentPolicy = row(“Policy Number”).ToString
      • If activity: strPreviousPolicy = strCurrentPolicy
        • Then: // Your logic for matching policy numbers
        • Else: // Your logic for non-matching policy numbers
    • Assign activity: intRowIndex = intRowIndex + 1

Hope this helps