If condition check if any of the text wanted is present

I have a datatable input from Excel in which there is a column called “Final Result”. In the For Each Row activity, some activities will be performed if in that row the final result is input as “Y”, “Yes”, “yes”, “y”, “YES”, “YEs”, “yES”, and “YeS”. For this, I am using If condition activity.

It would be ineffective coding if the condition is like this:

Row.Item(“Final Result”).ToString.Trim = “Y” Or Row.Item(“Final Result”).ToString.Trim = “Yes” Or Row.Item(“Final Result”).ToString.Trim = “yes” Or Row.Item(“Final Result”).ToString.Trim = “y” Or Row.Item(“Final Result”).ToString.Trim = “YES” Or Row.Item(“Final Result”).ToString.Trim = “YEs” Or Row.Item(“Final Result”).ToString.Trim = “yES” Or Row.Item(“Final Result”).ToString.Trim = “YeS”

So, I wonder if there is a better way to do this?

Hi,

Can you try the following expression?

Row.Item("Final Result").ToString.Trim.ToLower = "y" OrElse Row.Item("Final Result").ToString.Trim.ToLower = "yes"

Regards,

1 Like

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