Sorts the members of the set produced by the main command.
Syntax
SORTED BY «expression [ASCENDING|DESCENDING]»
Parameters
expression
An expression that identifies a field to be used as a sort key. Complex expressions must be enclosed in parentheses.
ASCENDING or DESCENDING
Specifies how the sort on the associated key is to be performed. ASCENDING (default) Sorts in “alphabetical order” (A-Z, 0-9). DESCENDING Sorts in “reverse alphabetical order” (Z-A, 9-0).
Comments
The sorting clause determines the order in which the selected records are to appear in the set. The fields to be used as sort keys (identified by each expression) must be part of the set produced by the main command.
If you omit the sorting clause, the software determines the order of the records.
Note: Existing result sets can also be sorted after selection – with the SORT command.
Example
list all Employees sorted by Department descending FirstName LastName
The preceding command lists all Employees by department (in descending order) and, within department, by first and last names (in ascending order).
report from Invoices sorted by {$month(InvoiceDate)-5 where $month(InvoiceDate) >= 6, $month(InvoiceDate)+7} : endreport
The preceding program fragment reports invoices in order by fiscal month, assuming that the fiscal year begins in June.
In a set specification, selects non-matching members of an EntitySet, a relationship with fields, an application document, or a result set.
Syntax
object (UNRELATED)
Parameters
object
The name of an EntitySet, a relationship with fields, a form, a structured application document, or a set. Can be a role name for an EntitySet or relationship with fields.
Comments
In a set specification, UNRELATED selects all records in object that do not satisfy the relationship condition expressed in the set specification.
UNRELATED can be used only once in a set specification.
This function is related to the theoretical partial outer join operation.
Example
> find all Employees (unrelated) WorkIn Departments
> list all LastName FirstName DeptNum DeptName DeptNum Johnston Leslie D07 Nelson John Kelly Pat
The preceding command finds all employee records that contain no DeptNum, or contain a DeptNum for which there is no corresponding department record. Missing values are undefined ($Null).
find all Employees WorkIn Departments (unrelated) keep Departments
The preceding command creates a list of all departments that have no employee records associated with them.
find all Managers (unrelated) Manage Employees
Finds all employees that do not manage anyone. (For a contrasting example, see COMPLETE.)
“Null” (a state of valuelessness). Cannot be reset by an application program.
Description
The “null” property. $Null can be written without the dollar sign.
When certain atomic expressions (variable name, field name, form field name, or formal parameter name) are used before being assigned values, or if the values are unknown, those expressions are considered to be $Null.
$Null is a property indicating a state of valuelessness; $Null is not itself a value. The null string is a value and is therefore not the same as the $Null property.
An arithmetic or functional expression that includes a $Null argument or operand always evaluates to $Null.
A logic expression that includes a $Null operand always evaluates to $False.
Because $Null is not a value, you cannot use the conditional operators = (Equals) and <> (Not Equals) to determine if an expression is $Null. Instead, the operator IS [NOT] [$]NULL is used as shown in the following example:
Salary is $null
Salary is null
Salary is not $null
Salary is not null
Note: You can write $Null without the dollar sign.
Example
if Salary is $null
let Salary = StartingSalary
... commands ...
endif
An IS $NULL comparison is logically true if expression is valueless (unassigned). If expression has been assigned any value (including the null string), then the comparison is logically false.
An IS NOT $NULL comparison is logically true if expression has been assigned any value (including the null string). If expression is valueless (unassigned), then the comparison is logically false.
$NULL can also be written as NULL.
Example
To find all employees whose records have no value recorded in the Age field, and then change that value to 39, enter
change all Employees where Age is $Null let Age = 39
An expression that evaluates to a character string.
pattern
An expression that evaluates to a character string. Pattern must consist of combinations of letters, digits, symbols, and the special wildcard characters % and _.
Return Value
Logical.
Comments
A LIKE comparison is logically true if expression matches patterns.
A NOT LIKE comparison is logically true if expression fails to match pattern.
Example
compute Employees where LastName like "_a%n"
Processes all records whose LastName values are three characters or more, the second character being an a, and the last character being an n.
find Parts where PartNo like "_ _\_%"
Finds all parts whose part numbers have an underscore as the third character.
find Parts where PartDesc like "%\\%"
Finds parts whose part description contains a backslash.
Quickly marks a large block of code that you want to prevent from running or that you want to be generated by the GENERATE command by putting the delimiters at the start and end of an output section in a template program.
Syntax
Place a two less than characters before the start of the code.
<< code / statements >>
Place a two greater than characters at the end of your code.
Parameters
code \ statements
one or more command statements, typically using macros, to send to the current output destination when the program containing them is processed with a GENERATE command
Comments
The program template delimiters, << and >>, must appear alone on a physical line in the application document. When the program is executed, parsed, or compiled, the statements between the delimiters are ignored.
When the program is run under the GENERATE command, the statements are sent as output, after macro substitution, to the current output device.
Example
… commands1 … << … commands2 … >> … commands3 …
Under normal execution, commands1 and commands3 execute normally; commands2 are ignored.
When the program is parsed or compiled, commands1 and commands3 are parsed or complied in the usual manner; commands2 are ignored.
When the GENERATE command is used, commands1 and commands3 execute normally; commands2 are sent as output, after macro substitution, to the current output device.
Marks the start and end of a macro name in an application program.
Syntax
<name>
Parameters
name
The name to be assigned to a global macro, or a digit from 0 to 9 referring to one of the local macros belonging to the current macro program.
Comments
A macro is a dynamically declared name that represents a character string. When a macro call is encountered in an application program, the macro call is replaced by the current character value of the macro.
A macro acquires values in one of two ways: implicitly, when the software encounters a call to a previously unknown global macro or unassigned local macro, or explicitly, in a LET or INPUT statement or a call to a local macro.
Example
let <EntSet> = "ENTS"
let <Name> = "EntName"
Defines the global macro to represent the string ENT. Then the statement