Hi All,
I am trying to compare two dates in a Data Table. Its correctly picking the two dates.
But after comparing it throws exception Max date not found Below is the screenshot.

Hi All,
I am trying to compare two dates in a Data Table. Its correctly picking the two dates.
But after comparing it throws exception Max date not found Below is the screenshot.
It was not matching the condition the excel date and max_date are not equal that’s why it was going to else and throw the error.
Hope it helps!!
@marina.dutta
Hi,
Try to store the maximun date in a variable ant then loop the dates and give the scope to main sequence.
Thanks
As per the condition you are checking if the dates are exactly matching and as per log messages your dates are different
Let us know what you want to check is it equals only?
cheers
Actually the I am looping the data table and checking if current row is max date . Incase the current row of the data table is max date it will click the max date. Do I need to include continue in my loop so that it goes to the next iteration and compare
Please check the dates were not same so the if condition is not satisfied and it went to else block and thrown the error
Regards
The output results are true. As the dates are not equal it is throwing exception
Hope it helps!!
Why not filter the datatable and get the required row directly?
after filter you can check filtereddt.count>0
cheers
Remove your throw activity …
you can include throw after for loop checking if click has happened or not
or ideally can follow using innertext as date and click would happen directly if present
cheers
Then loop the datatable in for each row in datatable and compare the condition in If condition.
In then condition give the click activity and in else don’t give any activity.
If you give throw it will stop at that throw and throws the error.
Happy Automation!!
You can simply get the max date by using this expression:
str_output = [YourDTVariable].AsEnumerable().Max(Function (drRows) DateTime.Parse(drRows.Item([YourColumnIndex/Name]).ToString)).ToString
Then pass the str_output variable in click activity selector to directly click the max date.
Hope it helps.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.