Support Portal

for ProcessRobot and WinAutomation

Start a new topic

Logical AND/OR operator in IF conditions

ADMIN

The AND "&&" operator can be used inside an "If" condition using the following format


First Operand: %TextVar_1 == "ABC" && TextVar_2 == "DEF"%

Operator: =

Second Operand: True



The OR "||" operator can be used in a similar way


First Operand: %TextVar_1 == "ABC" || TextVar_2 == "DEF"%

Operator: =

Second Operand: True


waj
waj

2 people like this idea

%TextVar_1 == "Suzuki" && TextVar_2 == "Honda" && TextVar_3 != "BMW" %


1 person likes this

thanks, yoko, that was the syntax that I had forgotten:  "  !=  "



1 person likes this

Peter,

Actually, I was wondering if there is a "NOT =="  Operator that could be combined within the Multiple AND,  syntax


1 person likes this

What if i want to use Logical AND/OR operator in "IF Web Page Contains ..." 

what shal i do ?

Ykaya,


The option you asking about is not supported.

I suggest you the regular expression with the Parse Text Action ....

Parse Text - Options: Check -Regular Expression, Check - "Find First Occurrence only"
Text: %TextVar%
Find Text:   ^ABC | ^DEF

If %TextVar_Position%  >= 0

    ....   It starts with ABC  OR Starts with DEF

Else

    .....  Starts with other
End If


ADMIN

Hello Yassin, you could add multiple CSS selectors in the Controls Repository. The Robot will search for the element using the selectors one by one, from top to bottom. 

Does this work with Case Statements?

ADMIN

Hello Jaye, it does work.


You can put the "First Operand" in the Switch Action and then "True" or "False" in the Case Action.

Hello Peter,

I think that remember that there was a way in the Multiple OR and Multiple AND syntax for IF statement action to specify, NOT conditions, but I can not remember the syntax.

If this is possible to work, can you paste an example of the syntax with Multiple OR, AND syntax  here ?

ADMIN

Hello Joseph,


You could write it like that:


First Operand: %TextVar_1 == "ABC" && TextVar_2 == "DEF" || TextVar_3 == "DEF" %

Operator: =

Second Operand: True

What if I want to use "Starts with" instead of "==" or "!=" how do I do that?


I've tried the following but WA doesn't accept it:

   

If
%TextVar Starts with "ABC" || TextVar Starts with "DEF"%
=
True

   

Login or Signup to post a comment