value is stored in a variable & Check with the excel column if the value is present or not
In my case, I have a value “56.00” stored in a variable,
I need to check whether the “56.00” value is present in the Numbers column in excel,
If it is present/Not present I need to perform other actions or log a message. How to do this with IF activity?
Book4.xlsx (9.4 KB)
Hi,
- read the excel file and put into data table
- use for each activity use use the data table
3.inside for each ( datatable)
if
row(0).tostring = variable 56.00
then
log " present"
else
“not present”
hope this helps
Hi @Praveen_Vs ,
You can use a for loop and a If condition to check for the required condition
In the Then block put the activities for matching case and Else part use the activities for not matching case.
If values are coming in double format then you case use the below for condition :
Cdbl(CurrentRow(“Numbers”).TOString.Trim).Equals(Cdbl(YourVariable))
Regards,
Rohith
@Ahmad_Rais @rohith.prabhu Its working, But if the Number is not found means i need to throw a business exception, So now it is iterating on the for each so every time when the Amount not match means, How to throw a Business Exception here ?
Hi @Praveen_Vs ,
In else part use the Throw activity and provide the below value for it.
New BusinessRuleexception(“Value mis-match”)
Regards,
Rohith
@rohith.prabhu @Gokul001
In the For each, It will check with the First value in the Excel, It doesn’t match means it will throw exception means, How it will check with the remaining numbers in Excel ?, Incase the value matches with the 4th or 5th row in excel.
@prave\
yes i concur
DT.Asenumerable.Any(Function(r) r(“Numbers”).Tostring.equals(“56.00”))
Output : Boolean (True/False)
Then use if Activity …if True Means Next Steps …False Means Throw BE
Thanks, This is what I’m looking for.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.