How to Compare 2 String values and update status in excel

Could any one pls here for below scenario

Scenario:
Step1:
From the Application getting Dynamic multiple text and updating in one column in Excel as Actual value.
Step2:
And updating Multiple dynamic manual calculation values in another column in the same Excel as the Expected Value.
Step3:
By using If condition How can I compare both values and update the status in Excel

Note: I have used the below condition in IF, Sometimes it’s working as expected but most of the time it’s not working, Directly it goes to ELSE condition, and sometimes, I am facing the below highlighted error in the Screenshot.

CurrentRow(“ActualAmountPayable”).ToString.Trim.Equals(CurrentRow(“ActualAmountPayablePQM”).ToString.Trim)

image

@ARAVINDH_RV

Can You share the input and expected output

@ARAVINDH_RV

Basically the error occurs if your datatable varaible is empty or the argument is getting null value

Can you check whether the datatable contains any values or not

In debug mode

Hi @ARAVINDH_RV

Try with this

If Not String.IsNullOrEmpty(CurrentRow(“ActualAmountPayable”).ToString) AndAlso Not String.IsNullOrEmpty(CurrentRow(“ActualAmountPayablePQM”).ToString)
Then
Perform the comparison here
Else
Handle the case where either value is null or empty

Hope this helps

You can compare 2 string values by using the EXACT Function or using the IF Function with SEARCH. The EXACT Function basically compares the two strings and returns TRUE if they are exactly the same and FALSE if they are not. This function is case-sensitive, meaning that it will consider uppercase and lowercase letters as different characters.

System Generated value Manual calculation Output
Actual Amount Expected amount Status
MYR 328.00 MYR 328.00 Pass

I not used data table for this script just I Have used IF condition

Hi sanjay,

Could you pls send the same in XML, It better helps to understand

Forum.zip (185.8 KB)

hope this helps

@ARAVINDH_RV

if you are using for each row in datatable

check the datatable variable which you have passed in that activity

Hi I have tried the same but eventhough values are same instead of pass its displays Fail
image

Hi Shiva,

Actually Iam not using datable in my scenario.