If - Conditional Test and Evaluation
Usage
|
value = If ( logical truevalue falsevalue ) |
|
value = If ( logical tagval ) |
|
value = Ifnot ( arguments same as If ) |
Parameters
|
value |
The point returned as the result. |
|
logical |
A point to be evaluated and tested as true or false. |
|
truevalue |
The point to be returned if logical is true. |
|
falsevalue |
The point to be returned if logical is false. |
|
tagval |
One or more of the tagged values below. |
Tagged Arguments
|
Else::falsevalue |
Return the value of falsevalue if logical is FALSE. |
|
ElseIf::newlogical |
If the value of logical is FALSE then evaluate newlogical and continue with the following arguments. |
|
Then::truevalue |
Return the value of truevalue if logical is TRUE. |
Description
If no tags are present then if the first argument is true then the second argument is returned otherwise the third argument is returned. If the first argument is false and no third argument is given then UV4:none is returned. Note that all arguments are evaluated when tags are not present. The quote prefix (@) may be used such that only the selected argument is evaluated.
If tags are present then only the selected tag is evaluated. If the selected tag is not given then UV4:none is returned.
The Ifnot module is the same as the If module except that it logically negates its first argument.
Examples
|
If(Cus.IsValid @Cus.BalanceDue "not valid")
|
|
If(Cus.IsValid Then::Cus.BalanceDue Else::"not valid") |
identical to prior example |
|
If({Money* < Money:0.00} Then::"Credit Due" ElseIf::{Money* = Money:0.00} Then::"no balance" Else::Str("Balance is " Money*))
|
|
If(FALSE Then::xxx) |
returns UV4:none |
|
Ifnot(TRUE Then::res1 Else::res2) |
returns res2 |
In - Test Point in Range of Points
Usage
|
logical = In ( npt1 npt2 ) |
|
result = In ( npt1 npt2 truept falsept ) |
Parameters
|
logical |
Logical:TRUE or FALSE depending on the result of the comparison. |
|
npt1 |
A point. |
|
npt2 |
A point. |
|
result |
The evaluation of truept or falsept depending on whether or not npt1 in npt2. |
|
truept |
A point. |
|
falsept |
A point. |
Description
The In module tests to see if npt1 is equal to or in the range of points specified by npt2. If npt2 references a single point then In is the same as the EQk module. If npt2 is a range of points or a list then In returns true if npt1 is in the range or false otherwise.
In recognizes the various date/time point types supported by V4. It is possible to test to see if a month or date is in a year, a date is in a month, etc. without any DTInfo conversions.
The In module may also be referenced with the infix operator "==". The operator "~=" may be used for "not in".
See Real for details on comparing floating point numbers.
When comparing two telephone points only the area code and number are considered. The type and extension (if given) are ignored.
Two strings are tested for an exact match, not a partial match. Use the Str Has option to test for partial string matches.
If the second argument to this module is a list then the elements of the list are tested until a match is found. If no match is found then FALSE is returned.
Examples
|
In(20 Int:1..50) |
Logical:True |
|
In(13 Int:1..10,20..30,50) |
Logical:False |
|
In(State:PA State:NJ,NY,PA,DE) |
Logical:True |
|
In(Had (Mary had a little lamb)) |
Logical:True |
|
In(UDate:970304 UYear:1997) |
Logical:True |
|
In("is" "Now is the time") |
Logical:Yes |
|
In(Money:11000 Sales*) |
Logical:True |
|
In(UDT:1/30/98:10:03 UTime:9:50..10:30) |
Logical:True |
|
In("he" ("Now" "is" "the" "time")) |
Logical:True |
Is1 - Tests to See If Point Refers to a Single Value
Usage
|
value = Is1 ( pt ) |
|
value = Is1 ( pt svalue mvalue ) |
|
value = Is1 ( point tagargs ) |
Parameters
|
value |
The point returned as the result. |
|
logical |
A point to be evaluated and tested for a single value |
|
svalue |
The point to be returned if the point refers to a single value. |
|
mvalue |
The point to be returned if the point refers to multiple values. |
Tagged Arguments
|
Else::value |
The value to be returned if the first argument does not reference a single point. |
|
ElseIf::logical |
If the first argument is not a single point then logical is evaluated. If the result is Logical:True then the following Then argument is evaluated. If it is Logical:False then the following Else argument is evaluated. Multiple ElseIf tags may be chained. |
|
Then::value |
The value to be returned if the first argument references a single point. |
Description
In the single argument mode, Is1 returns true if its argument point refers to a single value. In the three argument mode the second argument is returned if the first argument is a single value, otherwise the third argument is returned.
The Then, ElseIf, and Else tags may be used to explicitly define results or chain multiple conditionals.
Examples
|
Is1(Int:234) |
Logical:True |
|
Is1(Branch:East,West Int:23 Int:44) |
Int:44 |
IsAll - Tests to See If Point Refers to All Points on Dimension
Usage
|
value = IsAll ( pt ) |
|
value = IsAll ( pt avalue navalue ) |
|
value = IsAll ( point tagargs ) |
Parameters
|
value |
The point returned as the result. |
|
logical |
A point to be evaluated and tested for a single value |
|
avalue |
The point to be returned if the point refers to all points on a dimension. |
|
navalue |
The point to be returned if the point does not refer to all points. |
Tagged Arguments
|
Else::value |
The value to be returned if the first argument does not reference all points. |
|
ElseIf::logical |
If the first argument is not a single point then logical is evaluated. If the result is Logical:True then the following Then argument is evaluated. If it is Logical:False then the following Else argument is evaluated. Multiple ElseIf tags may be chained. |
|
Then::value |
The value to be returned if the first argument references all points on a dimension. |
Description
In the single argument mode, IsAll returns true if its argument point refers to all points on a dimension. In the three argument mode the second argument is returned if the first argument refers to all points, otherwise the third argument is returned.
The Then, ElseIf, and Else tags may be used to explicitly define results or chain multiple conditionals.
Examples
|
IsAll(Int:3,4,5) |
Logical:False |
|
IsAll(Branch:East,West Int:23 Int:44) |
Int:44 |
|
IsAll(cusType..) |
Logical:False (because cusType.. evaluated into list of values) |
|
IsAll(@cusType..) |
Logical:True |
|
Context Add MakeP(Dim:cus Special::All) |
(put cus.. into context) |
|
IsAll(cus*) |
Logical:True |