If (Complex) |
Top Previous Next |
×V3.0Ø
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.
Comparison Operators The following operators can be used to compare numeric values and strings.
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.
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.
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
|