If (Complex)

Top  Previous  Next

×V3.0Ø

S

A

W

WS

ü

ü

 

Complex If Comparisons are used to make multiple comparisons in the same line in addition to performing more complex math.  For example, a single line could check to see if a date is less than one date AND greater than another date.  In order for the complex If comparison to be evaluated properly, the expression must be inside parentheses.  The complex  If comparisons also allow evaluate if an expression is NOT true.

 

Boolean Operators

The following operators can be used to compare values and strings.

Operator

Sample

Evaluation

AND

If ((expression1) AND (expression2)) ...

Returns true if both expressions evaluate to true

OR

If ((expression1) OR (expression2)) ...

Returns true if either expression1 or expression2 is true

!

If (!(expression1))...

Returns true if expression1 evaluates to false

 

Comparison Operators

The following operators can be used to compare numeric values and strings.

=, EQ

Equal*

<>, NE

Not Equals

>, GT

Greater than

>=, GE

Greater than or equal to

<, LT

Less than

<=, LE

Less than or equal to

 

Note:  The symbols =, <>, >, >=, <, <= are only supported if the entire If construction is between parentheses.

 

Samples:

If (x <= 90 AND x > 0) THEN ...

If (x LE 90 AND x GT 0) THEN...

 

Date Comparison Operators

The following operators can be used to compare dates.

#EQ

Equal

#NE

Not Equals

#GT

Greater than

#GE

Greater than or equal to

#LT

Less than

#LE

Less than or equal to

 

Mathematical Operators

The same mathematical operators (+, -, /, *) are supported in the complex If structure, but there is no restriction to the number of operations that are performed.   Additional parentheses can be used to added.

 

Sample:

If (z > ((x+y)/2)) THEN ...

 

Special Operators

When using the special comparison operators in complex If comparisons, the comparison operators must appear inside parentheses (See Samples below). Operators must be followed by another set of parentheses and any parameters must be inside the parentheses and separated by commas.

 

IsAllAlpha(<StringExpression>)

Returns True if all characters are letters, see also IsAllAlpha

IsAllNumeric(<StringExpression>)

Returns True if all characters are numeric digits, see also IsAllNumeric

IsAllAlphaNumeric(<StringExpression>)

Returns True if all characters are a mix of letters & numeric digits, see also IsAllNumeric

EOF()

Returns True if the end of the input file has been reached.

EndOfLine()

Returns True if there is no more data in the current record.

EndOfList(<ListName>)

Return True if the end of the specified list has been reached.  See also EndOfList. Note:  List Name must be inside double quotes.

ListExists(<ListName>)

Return True if the specified list exists.  See also ListExists. Note:  List Name must be inside double quotes.

FileExists(<PathAndFileName>)

Returns True if the file exists, see also FileExists

FileIsReady(<PathAndFileName>)

Returns True if the file exists and can be opened for reading, see FileIsReady

IsDate(<StringExpression>)

Returns True if the <StringExpression> is a date, see also IsDate

Like(<StringExpression>, <Pattern>)

Returns True if the <StringExpression> fits the <Pattern>, see LIKE.

Mod(<Number1>, <Number2>)

Returns the remainder when <Number1> is divided by <Number2>

FindString(<String1>, <String2>)

Returns the position of the first occurrence of <String2> within <String1> See also, FindString.

ObjectExists(<ObjectName>)

Returns True if the object exists, see also ObjectExists

CheckS(<String>," *" or <row>, <col>)

This function works like Check S.  However, the parameters must appear inside parentheses and should be separated by commas.  Note:  If the asterisks (*) is to be used, it should appear between quotes.

Sample:

    If (CheckS("PATIENT MANAGEMENT",  "*")) THEN

    ...

    EndIf

Length(<String>)

Returns the length of the string.

IN(Value, Value1, ...ValueN)

Returns true if Value (the first value listed) appears in the subsequent list of values.  This search is case-sensitive.

WebElementExists(<ElementID>,<Timeout>)

Returns True if the web element exists, see also WebElementExists

WebElementAllowsFocus(<ElementID>,<Timeout>)

Returns True if the web element exists, see also WebElementAllowsFocus

ElementExists("AppName",<ElementID>,<Timeout>)

Returns True if the windows element exists, see also ElementExists

ElementAvailable("AppName",<ElementID>,<Timeout>)

Returns True if the windows element is enabled, see also ElementAvailable

 

Note: If a numeric value is being compared to a string, the comparison will be a string (alphabetical) comparison.  If two numeric values are compared, they will be compared as numbers even if one or both is in quotes.   Therefore, "0" would be considered equal to "000" in both the standard comparison and the complex comparison.  This behavior maintains backward compatibility with OLIE.

 

Sample 1:

       The following example checks to see that you are not at the end of the input file.

If (!EOF()) Then

...

EndIf

 

Sample 2:

       The following example checks the existence of a file and if it does not exist, the script ends with an ExitError.

If (!FileExists("c:\emue\script1\chrg.txt")) Then

ExitError

EndIf

 

Sample 3:

       The following example checks to see that the variable PTID has a length of 11.

If (Length(PTID) = 11) Then ...

 

Sample 4:

       The following example checks to see if the date, ChgDate, is between two specific dates.

If (date1 #GT "01/01/2005" AND date1 #LT "12/31/05") Then

 

Sample 5:

       The following example checks the existence of a webelement and if it does not exist, then log an error message.

If (!WebElementExists("Browser=Google::Textbox,id=username,INDEX=1",10000) Then

Logline Unable to find UserName field.

EndIf

 

Sample 6:

       The following example checks to see if we are NOT at the end of a list. Please note that the list name must be inside double quotes.

If (!EndOfList("Excel")) Then

       Goto Done

EndIf

 

Sample 7:

       The following example checks to see if the value of TransCd is contained in the subsequent list of numbers.

If (In(TransCd,30301,30302,30303,30304,30305,30306)) Then

       Call ProcessCode

Else

       Logline TransCd " is not a valid code."

EndIf