Assigns a value to a variable object.
Syntax
LET expression
Parameters
target | A global or local variable, a form field or menu item, a parameter, or a macro can be used. Subscripted (array) variables are valid. |
expression | Any value expression. The value of expression is assigned to target. Expression can include literals, constants, global or local variables, form fields, menu items, parameters, or fields in the current set. These objects can be combined using any of the arithmetic operators and functions. |
Comments
The LET command is used to assign values to variable objects. To assign values to a field in an EntitySet or relationship, you must use ADD, CHANGE, INSERT, or UPDATE (which can contain a LET subcommand). The LET command is not used to assign values to database fields.
An assignment expression is formed by enclosing the LET command in parentheses.
If expression evaluates to $Null and target is a macro, the macro is assigned the null string. (A null string is a string of zero length, which is not the same as the $Null property.)
Example
let var1[1]=1 var1[2]=2 var1[3]=3
let var1 = $Date var2 = $tolower(LastName) var3[2] = 123
An example of using LET to assign values to variables.
let = “where LastName = Smith”
let= “from terminal prompt”
let <5> = $null
An example of using LET to assign values to macros.
See Also
Macros
ADD
CHANGE
How To Use Variables
INSERT
SET QUOTING
UPDATE
WHERE
Computes the results of one or more expressions for a set of records.
Syntax
COMPUTE [num] [setspec] EVALUATE clause [-> clause]
Parameters
num | Can be an integer constant (15, 200); a variable, form field, or parameter that evaluates to an integer; the word ALL. If num is omitted, or less than 0, it defaults to ALL. |
setspec | The set specification (made up of application documents, EntitySets, relationships, forms, or result sets), designating the records to be changed. If omitted, the current set (if available) is used. Application documents named in the set specification cannot be updated. |
Comments
COMPUTE evaluates one or more expressions for a set of records without having to first LIST the data or create a result set of the desired records.
Example
Compute all Employees where LName=Smith \
evaluate \
(let TotSal = $total(Salary)) \
(let MaxSal = $max(Salary)) \
(let MinSal = $min(Salary)) \
(let NoOfEmps = $count(LName)) \
(let AvgSal = $average (Salary))
output TotSal MaxSal MinSal NoOfEmps AvgSal
Processes the EVALUATE clause for every employee whose last name is “Smith”. The OUTPUT command displays the results.
form open dInvoice
form display input
compute fInvItems evaluate (let fInvBott.InvTot = $total(fInvItems.Amt))
form display fInvBott.InvTot
Calls up a display and calculates a total after all items have been added.
See Also
$MEMBERCOUNT
FIND
Gets serial input from the application user.
Syntax
INPUT «target»
Parameters
target | A list of one or more global or local variables, form fields, menu items, parameters, or macros, in any combination. Subscripted (array) variables are valid. Each item must be separated from the next by a space. |
Comments
INPUT provides a simple means of reading a line of input from the application user. The line of input is divided into literal strings based on the delimiter character currently in effect. The literals are assigned to the variables and macros specified in target, in order from left to right.
Example
input TestVar fEmpform.LastName Param1 < CommandName> <3>
When the above command pauses for input, the following constants can be input by the application user:
32 Smith abc LIST abc_def
If current delimiter is the space character, the constants are assigned as follows:
TestVar | 32 |
fEmpform.LastName | Smith |
Param1 | abc |
#< CommandName> | LIST |
#<3> | abc_def |
The following sequence of entries accomplishes the same effect, but uses the comma as the delimiter:
set delimiter “,”
input TestVar fEmpform.LastName Param1 < CommandName> <3>
32,Smith, abc,LIST, abc_def
Attention
When using the following construction, a “:” must be placed at the end of the OUTPUT string:
OUTPUT “Please, respond with Yes or No (Y/N): “;
input vResponse
See Also
SET DELIMITER
OUTPUT
Moves the current member pointer one or more members down in a result set.
Syntax
DOWN [num] [setname]
Parameters
num | The number of members farther “down” into setname that the current member pointer is to be moved. Num can be an integer constant (15, 200); a variable, form field, or parameter that evaluates to an integer; the word ALL. The default value for num is 1. If num is negative, DOWN num actually moves the current member pointer “up” in the set. |
setname | The name of the result set whose current member pointer you wish to move. If setname is omitted, the current set is used. |
Comments
NEXT is a synonym for DOWN.
Example
down 10
Moves the current member pointer 10 members “down” towards the end of the set.
down 5
delete 5
Moves the current member pointer five members “down” and then deletes five members (starting with the new current member).
find Customers -> CustSet
form open fCustomer
form set accelerator F1 F2 Escape
while
change fCustomer from CustSet
form display input
if Event.EventName = “escape”
break
else % use $direction as a handy variable
let $direction = {-1 where Event.EventName = “F1”, 1}
endif
down $direction CustSet
endwhile
Finds a set of customers and then displays the records in the set one at a time.
See Also
$currentmember
BOTTOM
DOWN
LOCATE
PREVIOUS
TOP
UP
Opens an application directory to use the objects contained in it.
Syntax
ACCESS dirname [READ|UPDATE]
Parameters
dirname | Specifies the name of an application directory. |
READ | Specifies that you can only read object definitions in dirname, not update object definitions. If neither READ nor UPDATE is specified, READ is the default value. |
UPDATE | Specifies that you can read and update object definitions in dirname. |
Comments
Initializing an application database (New Database) creates a base application directory called zim. Additional application directories are defined as objects in the application database. To access any directory other than the base application directory, you must issue an ACCESS command for that directory.
Once a directory has been accessed, objects in that directory are available for use. To close a directory (and its objects) to further access, use the RELEASE command.
Use the CREATE, ERASE, RENAME, PERMISSION, ENCRYPT, DECRYPT, COMPILE, UNCOMPILE, SET SIZE, and SET SELECTIVITY commands to change object definitions only in an application directory accessed using the UPDATE option.
By accessing a directory using the READ option, you prevent unwanted modification of the directory contents. Foreign directories can be accessed using READ only.
Example
To access directory ProjectControl in read-only mode, use
access ProjectControl read
or
access ProjectControl
To access the directory Personnel in update mode, use
access Personnel Update
See Also
$dirpath
COMPILE
CREATE
DECRYPT
ENCRYPT
ERASE
PERMISSION
RENAME
SET SELECTIVITY
SET SIZE
UNCOMPILE
UPDATE
Moves the current member pointer one or more members “down” in a result set.
Syntax
DOWN [num] [setname]
Parameters
num | The number of members farther “down” into setname that the current member pointer is to be moved. Num can be an integer constant (15, 200); a variable, form field, or parameter that evaluates to an integer; the word ALL. The default value for num is 1. If num is negative, DOWN num actually moves the current member pointer “up” in the set. |
setname | The name of the result set whose current member pointer you wish to move. If setname is omitted, the current set is used. |
Comments
NEXT is a synonym for DOWN.
Example
down 10
Moves the current member pointer 10 members “down” towards the end of the set.
down 5
delete 5
Moves the current member pointer five members “down” and then deletes five members (starting with the new current member).
find Customers -> CustSet
form open fCustomer
form set accelerator F1 F2 Escape
while
change fCustomer from CustSet
form display input
if Event.EventName = “escape”
break
else % use $direction as a handy variable
let $direction = {-1 where Event.EventName = “F1”, 1}
endif
down $direction CustSet
endwhile
Finds a set of customers and then displays the records in the set one at a time.
See Also
$currentmember
BOTTOM
LOCATE
NEXT
PREVIOUS
TOP
UP
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
Ends execution of an application program and returns to the “previous” command level.
Syntax
RETURN [TO procedure]
Parameters
procedure | The name of a procedure. Must be an ancestor (i.e., the “parent”, “grandparent”, “great-grandparent”, etc.) of the current procedure. |
Comments
The RETURN command stops execution of the current procedure.
If a TO clause is omitted, execution control returns to the calling procedure (the “parent”) at the command immediately following the call that started execution of the current procedure.
If a TO clause is used, execution control returns to the specified procedure, provided that it is found along the chain of procedures that are “ancestors” of the current procedure. Execution resumes at the command immediately following the call that started execution of the offspring procedure in the current chain. If the specified procedure is not found along the chain of ancestors, execution control returns to the main prompt level.
If the RETURN command is entered at the main prompt level, the application session is ended (just as if a BYE command had been issued).
Example
To return control from the current procedure to the calling procedure when a FIND command returns an empty result set, enter
find all Employees where Salary > 10000
if $setcount = 0
return
endif
To return to a grandparent procedure if a FIND command returns an empty result set, enter
01 procedure Grandparent ( )
02 Parent ( ) % goes to line 20
… more commands …
18 endprocedure
19 %————————————————-
20 procedure Parent ( )
21 Child ( ) % goes to line 35
… more commands …
33 endprocedure
34 %————————————————-
35 procedure Child ( )
36 find all Employees where Salary > 10000
37 if $setcount = 0
38 return to Grandparent % goes to line 03
39 endif
… more commands …
50 endprocedure
See Also
BYE
SET FLOW
STOP
TRANSACTION
TRANSFORM
Performs a Boolean AND of two logic expressions.
Syntax
expression1 AND expression2
Parameters
expression1 | A logical expression using conditional and Boolean operators. If the expression is complex, it must be enclosed in parentheses. |
expression2 | A logical expression using conditional and Boolean operators. If the expression is complex, it must be enclosed in parentheses. |
Return Value
Logical, as follows:
Truth Table for Boolean AND | Expression1 |
True | False |
Expression2 | True | True | False |
False | False | False |
Comments
This AND is not the same as the AND used with the BETWEEN operator.
Example
ClaimType = ‘Auto’ and DamageCost > 3000 and LastName= ‘Andretti’
This Boolean expression is logically true only when the insurance claim type is Auto, the cost of the damage is greater than 3,000, and the last name of the person making the claim is Andretti. Otherwise, the Boolean expression is logically false.
See Also
[NOT] BETWEEN
NOT
XOR
OR
IN
Specifies the fields that are selected for a report
Syntax
DETAIL LINE [colheadings] [GRAPHIC [TEMPLATE name]] reportitem [:format:] [WHERE clause]
Parameters
colheadings | Can be COLUMN HEADING OFF Specifies that column break headings are not to be re-displayed at the top of each report page. LEVEL n [WIDTH n ] LEVEL 0 causes level 0 column break headings to be printed at the top of each report page. This is the default break level. LEVEL n causes column break headings to be printed for each break level n or higher in the hierarchy (n must be an integer greater than or equal to 0). WIDTH n sets the width (in characters) of the space allotted to the column break heading. |
TEMPLATE name | For graphical reports, the name of an optional template to define the layout of the report. |
reportitem | Any value expression. If the expression is complex, it must be enclosed in parentheses. |
format | A set of instructions defining the format for the associated reportitem. Format is enclosed in : (colons) and can consist of any valid combination of format options. |
Comments
The DETAIL LINE command is executed for every record of the set specified in the REPORT FROM command.
The column headings for all reportitems specified in the DETAIL LINE command are displayed, subject to any colheadings specification.
Only one detail line is produced for each record of the report set. If more than one DETAIL LINE command is used in a report specification, the DETAIL LINE command that is executed for a particular record in the report set is the first DETAIL LINE without a WHERE clause, or the first DETAIL LINE whose WHERE clause is true for that record.
For more information on format, see Available Format Options.
See Also
Boolean Expressions
Conditional Expressions
BREAK (Reports)
COLUMN BREAK
How to Use The Report Generator
How To Use Value Expressions