Performs a Boolean XOR of two logic expressions.
Syntax
expression1 XOR expression2
Parameters
expression1 | Any conditional expression or Boolean expression. If the expression is complex, it must be enclosed in parentheses. |
expression2 | Any conditional expression or Boolean expression. If the expression is complex, it must be enclosed in parentheses. |
Return Value
Logical as follows:
Truth Table for Boolean XOR | Expression 1 |
True | False |
Expression 2 | True | False | True |
False | True | False |
Comments
Performs a Boolean XOR (exclusive OR) of two logic expressions.
Example
LastName = “Smith” xor FirstName = “John”
The entire expression is logically true only if LastName is Smith or FirstName is John, but not both; otherwise, the entire expression is logically false.
See Also
About Boolean Expressions
About Conditional Expressions
OR
Locates the first occurrence of a pattern in a character string.
Syntax
$position(source,pattern)
Parameters
source | a character string, or an expression that evaluates to a character string |
pattern | a character string, or an expression that evaluates to a character string |
Return Value
Number, being the position of the first character in source that matches the first character of pattern, when pattern is found in source.
Comments
$position returns a number that identifies the start position of pattern in source. If pattern is not found in source, $position returns 0.
If either source or pattern is not of a character data type, it is converted to a character string before the operation begins. If source is of data type ALPHA or VARALPHA, the operation is case-insensitive; otherwise, the operation is case-sensitive.
Example
$position(var1,"ab")
Evaluates to 4 if var1 is “defabc”.
$position("abcdef","zz")
Evaluates to 0.
find all Customers where $position(Comments, "overdrawn") > 0
Determines if the word overdrawn appears in the Comments field for any one of your Customers.
See Also
$concat
$delete
$insert
$left
$replace
$right
$substring
$translate
About Character Literals
About Functional Expressions
Inserts a character string into another character string.
Syntax
$insert(source,position,string)
Parameters
source | a character string, or expression that evaluates to a character string |
position | a number or an expression that evaluates to a number |
string | a character string, or expression that evaluates to a character string |
Return Value
Character string consisting of source, with string embedded starting at the specified position.
Comments
Use $insert to produce a string consisting of source, with string embedded starting at position.
In a string, the position of the first character is always 1. If position is beyond the end of source, then string is appended to source. If position is zero or negative, then source is left unchanged.
Example
$insert("12345",3,"abc")
Evaluates to “12abc345”.
$insert("abc",1,"de")
Evaluates to “deabc”.
$insert("abc",4,"def")
Evaluates to “abcdef”.
$insert($delete("abcdef,2,2),2,"123")
Evaluates to “a123def”.
See Also
$delete
$fill
$left
$position
$replace
$right
$squeeze
$substring
$translate
Converts an expression to the alpha data type and sets the length of the result.
Syntax
$toalpha(expression,length)
Parameters
expression | Any value, or an expression that yields any value. |
length | A number. Can be a constant, a variable, a parameter, a menu item, or a form field. |
Return Value
Character string (alpha), length bytes long.
Comments
Use $toalpha to convert expression to the alpha data type in an area length bytes long. If length is negative, the result string is set to the maximum possible length. If length is zero, the result is the null string.
String comparisons involving this function are case-insensitive.
If expression is a number, the number is converted to character string form in an area length bytes long. If the given area is not large enough to hold the converted value, an error results.
Example
Assume that LastName is “Smith “.
$toalpha(LastName,3)
Evaluates to “Smi”.
$toalpha(LastName,12)
Evaluates to “Smith “.
$toalpha(50,2)
Evaluates to “50”.
$toalpha(20+30,19)
Evaluates to ” 50″ (17 leading spaces).
$toalpha(200+300,20)
Evaluates to ” 500″ (17 leading spaces).
$toalpha(500,-2)
Evaluates to ” 500″ (14 leading spaces).
list all Emps format $toalpha(FirstName,6), $toalpha(LastName,9)
Alters the width of values being output with a LIST command.
See Also
$left
$substring
$tochr
$tonumber
$toord
About Character Literals
About Functional Expressions
Conversion Between Data Types
Deletes a portion of a character string.
Syntax
$delete(source,position,length)
Parameters
source | a character string or an expression that evaluates to a character string |
position | a number or an expression that evaluates to a number |
length | a number or an expression that evaluates to a number |
Return Value
Character string, consisting of source, less those characters starting at position, for a length of length.
Comments
In a string, the position of the first character is always 1. If position is beyond the end of source, or if position is zero or negative, then no characters are deleted from source.
If length is zero or negative, then no characters are deleted from source.
If there are fewer than length characters from position to the end of source, then all characters from position to the end of source are deleted.
Example
$delete("abcdef",2,2)
Evaluates to “adef”.
$delete("613-555-1234",1,4)
Evaluates to “555-1234”.
See Also
$concat
$fill
$insert
$left
$position
$replace
$right
$squeeze
$substring
About Character Literals
About Data Types
About Functional Expressions
Locates a particular member of a result set and makes it the current member.
Syntax
LOCATE [num] [set] [WHERE clause]
Parameters
num | The number of records to be located. Num can be an integer constant (e.g., 15, 200); a variable, form field, menu item, or formal parameter that evaluates to an integer; the word ALL. The default value for num is 1. |
set | The name of a result set. If not specified, the current set (if it exists) is used. |
Comments
LOCATE starts searching at the current member of the set. The last member located becomes the current member of set. The system variable $Located is set to the number of members located, indicating the number of members in the result set.
The WHERE clause can be used to logically limit the members located.
Example
find all employees where location=”Detroit” -> DetroitSet
locate DetroitSet where FirstName=”John” and LastName=”Smith”
locate 2 DetroitSet where FirstName=”John” and LastName=”Smith”
Because LOCATE starts with the current member of any set it searches, the current member after the last LOCATE command is the third record containing the name John Smith.
find all Employees where LastName=”Smith” -> Smiths
locate all where FirstName=”John”
output $located
compute all Employees where LastName=”Smith” and FirstName=”John” valuate (“”)
output $membercount
find all Employees where LastName=”Smith” and FirstName=”John”
output $setcount
All three of the preceding examples determine how many employees have the name John Smith.
while
locate DetroitSet where LastName=”Smith” and FirstName=”John”
if $located = 0
return % checks if done
endif
ProcessEmp ( ) % program to process this John Smith
endwhile
Each John Smith record in the designated set is processed.
See Also
BOTTOM
DOWN
NEXT
PREVIOUS
TOP
UP
Changes data in EntitySets, relationships, forms, or sets.
Syntax
UPDATE [ALL] [SQLsetspec] SET «field = value »
[WHERE clause [EVALUATE clause] [-> clause]
Parameters
ALL | Optional. Regardless of whether ALL is entered, all records in the set specification that meet the specified condition (if any) are updated. |
SQLsetspec | An SQL set specification. Can contain application documents, EntitySets, relationships, forms, and sets. Role names are permitted. If SQLsetspec is omitted, the current set is used (if it exists). Application documents named in the SQLsetspec may not be updated. |
field | A target field in SQLsetspec. |
value | Can be: Any value expression. The keyword NULL. Field is assigned either the value of the expression, or the $Null property, as specified. Any number of field = value assignments may be entered. If a field is not explicitly specified for update, its value remains unchanged. |
Comments
The function of the UPDATE command is similar to that of the CHANGE command. UPDATE is able to update more than one database file in one command.
Example
update Employees set Salary = Salary * 1.1
change all Employees let Salary = Salary * 1.1
The preceding two commands are equivalent. Notice that, although the ALL has been omitted from the UPDATE command, it nevertheless updates all records that conform to the set specification.
update Employees, Departments
set Employees.Salary = Departments.StdSalary
where Employees.DNo = Departments.DNo
In the preceding command, the join condition appears in the WHERE clause. Notice that no relationship is needed.
See Also
ADD
CHANGE
Conventions
USING
In a set specification, qualifies a relationship.
Syntax
relationship («USING obj1 AS obj2»)
Parameters
relationship | The name of the relationship being qualified. |
obj1 | The name of an object used elsewhere in the set specification in which relationship appears. Must be the name or role name of an EntitySet, relationship, form, or application document. Must refer to same underlying object as obj2 (e.g., one is a role name for the other). |
obj2 | The name of one of the objects associated by relationship. Must be the name or role name of an EntitySet, relationship, form, or application document. Must refer to same underlying object as obj1 (e.g., one is a role name for the other). |
Comments
When a set specification includes a relationship, two principles are used to determine the validity of EntitySets associated by the relationship:
- If the relationship condition contains an EntitySet name, then that EntitySet name, or any role for it, may be used in set specification involving the relationship.
- If the relationship condition contains a role name, only that role name may be used in a set specification involving the relationship.
The USING subcommand helps to eliminate any ambiguity as to which objects are to be associated in a set specification. Ambiguity may develop when an object, or role for that object, appears more than once in a complex set specification.
Example
list all Employees WorkFor
Managers WorkFor (using Managers as Employees
using Bosses as Managers)
Bosses
Lists all bosses (managers of managers).
list all Employees WorkFor Managers
WorkIn (using Managers as Employees) Departments
The USING subcommand associates the departments with the managers, not with the employees.
See Also
– (Dynamic Rename)
COMPLETE
UNRELATED
Modify certain attributes of fields.
Syntax
SET <fieldname> REQUIRED ON|OFF
SET <fieldname> FIELDLISTWIDTH <number>
SET <fieldname> HEADING <charstring>
SET <fieldname> MASKFIELD <charstring>
SET <fieldname> REMNAME <charstring>
Parameters
fieldname | The name of a field. |
ON or OFF | Specifies if the field can have the value $null. This is equivalent to changing the REQD field to “yes” or “no”. |
number | An integer constant. |
charstring | A character string. |
Comments
This SET command enables users to modify certain attributes of fields without doing an ERASE and CREATE command. These SET commands modify the operational state of the fields and are in effect until the field’s owner is erased.
The SET REQUIRED command changes if a field can have the value $null. This is equivalent to changing the REQD field to “yes” or “no”.
SET FIELDLISTWIDTH alters the list width of a field.
SET HEADING and SET MASKFIELD alter the heading and mask patterns for a field. Setting HEADING and MASKFIELD to the zero length string ” effectively deletes any heading or mask that was previously defined.
SET REMNAME specifies a new remote name for the field or deletes the existing remote name if the new setting is ”.
The SET SELECTIVITY is identical to the existing SET SELECTIVITY command, except that the is specified before the attribute SELECTIVITY rather than after.
See Also
SET SELECTIVITY
Checks whether a given Zim object exists in a Zim directory.
Syntax
$exist$(Zim directory name, object name, object type)
Parameters
Zim directory name | A character string or an expression that evaluates to a character string, naming the ZIM directory to which the object would belong |
object name | A character string or an expression that evaluates to a character string specifying the object name to be checked in the Zim directory name for its existence |
object type | A number or an expression that evaluates to a number determining the type of the object name |
Return Value
It returns a $True value if the object name is defined in the Zim directory and is of the specified object type.
It returns a $False value if the object name is not defined in the Zim directory or is not of the specified object type or the Zim directory name is already accessed.
If the object type is 0 (zero), the function will return the object type of the object for subsequent reading of the status of this object (see example).
If the object type is non-zero and the Zim directory name is empty (“”), then the return value is the owning directory name of that object.
Comments
The types of the object are described as the following table:
Object Type | Meaning |
0 | Returns the Object Type |
1 | A Null Object |
2 | Shadow Directory |
3 | Directory |
4 | Entity Set |
5 | Field |
6 | Relationship with no Fields |
7 | Relationship with Fields |
8 | Set |
9 | Document |
10 | List |
11 | Form |
12 | Role |
13 | Variable |
14 | Display |
15 | Virtual Field |
16 | CSet |
17 | Window |
18 | Constant |
19 | Menu |
Examples
Check whether the directory “Accounting” is defined in Zim:
$exist$("ZIM", "Accounting", 2)
Investigate the type of the object “Customers” in directory Zim and then test whether it exists or not:
let Var = $exist$("ZIM", "Customers", 0)
$exist$("ZIM", "Customers", Var)