Compares one value to a list of values.
Syntax
expression [NOT] IN («expr»)
Parameters
| expression | An expression that evaluates to either a number or a character string. |
| expr | A list of expressions whose values are to be compared to expression. Members of the list are separated from one another by commas. |
Return Value
Logical
Comments
An IN comparison is logically true if expression is equal to at least one of the values in the specified list.
A NOT IN comparison is logically true if expression is not equal to any of the values in the specified list.
In either case, the comparison ends as soon as a logically true instance is found.
Example
The conditional expression that follows is logically true if the value of AirPollutants matches any of CFC, CO, or NOX.
AirPollutants in (" CFC","CO"," NOX")The conditional expression that follows is logically true if the value obtained from either TicketAmt*5 or Receipts*10 equals 10,000.
10000 in ( TicketAmt * 5,Receipts * 10)
See Also
About Conditional Expressions
Copies files from the client side to the server side.
Syntax
$copytoserver(source file name, destination file name, file type)
where
| source file name | an expression that evaluates to a character string containing a valid file address |
| destination file name | an expression that evaluates to a character string containing a valid file address |
| file type | an expression that evaluates to a character string that starts either with “B” (from “Binary”) or “T” (from “Text”) |
Return Value
The value return by this function is the file address of the destination if it is executed correctly; otherwise, it will return a $Null value.
Comments
This function is designed to work under ZIMTC and copies file from the client side to the server side using the file type specified. Files of the binary type are sent as they are, without their contents being checked (like images, videos, etc). On the other hand, files of the text type are copied using text file conventions for Windows and Unix.
Both the source and the destination file names can be either relative or absolute file paths. The following remarks apply to these paths:
| source file is absolute | the file is taken from the absolute path. Care should be taken because this absolute path refers to a location in the client’s machine; if there are many different users running, all users must have the same valid address |
| destination file is absolute | the file is written onto the absolute path |
| source file is relative | the file is read from a place that is relative to the current directory in the client session which is always where the Zimtc session has been started |
| destination file is relative | normally, the current directory is the database directory; therefore, the file will be written on a place inside the current directory |
If the destination file name contains sub-directories that don’t exist, they are created.
The ZIM executable ignores this function as it makes no sense copying a file to itself.
Example
This example copies the text file from the database path to a fixed location in the server’s machine.
out $copytoserver("mytext.txt", "c:\mextext.txt", "T")Related Topics
$copytoclient
Specifies the current field delimiter.
Syntax
SET DELIMITER character
Parameters
| character | Any valid character. The space, forward slash, comma, and quotation mark are the most commonly used. If character is not a letter or a digit, it must be enclosed in quotation marks. If character is a special character such as space or backslash, it must be enclosed in quotation marks. If character is a string longer than one character in length, only the first character in the string is used as the delimiter. |
Comments
The default field DELIMITER is the space character.
The specified character is used as a delimiter by the INPUT command (input from the terminal), by the ADD and CHANGE commands (input from an unstructured application document), and by the LIST and OUTPUT commands (output to the terminal or an unstructured application document) in either normal or comma-delimited format.
If the space is specified as the delimiter, then tab is also acknowledged as a delimiter, and multiple spaces are considered to constitute a single delimiter.
In comma-delimited format, the space causes the comma to be used as the delimiter for both input and output.
Example
set delimiter “/”
set delimiter ‘”‘
set delimiter “‘”
In the preceding examples, the slash, double quotation mark, and single quotation mark, respectively, are specified as the delimiter. (Only one delimiter character can take effect at one time.)
See Also
SET INPUT FORMAT
SET OUTPUT FORMAT
SET SPECIALSCAN
SET TEXTDELIMITER
COMPLETE
Used as a part of a set specification to select both matching and non-matching members of an EntitySet, a relationship with fields, a form, a menu, a result set, or a structured application document.
Syntax
object (COMPLETE)
Parameters
| object | The name of an EntitySet, a relationship with fields, a structured application document, a form, a menu, or a result set. Where applicable, may be a role name. |
Comments
COMPLETE, when used in a set specification, selects all records in the associated object regardless of whether they satisfy a modifying relationship. This function is related to the theoretical partial outer join operation.
Note: When using the WHERE clause with COMPLETE, if the conditions specified by the WHERE clause are not met, then no data is returned, even though the COMPLETE option has been specified.
Example
list Employees (complete) WorkIn Departments
Lists all employees regardless of whether they work in a particular department. If some employees lack corresponding Departments values, then the Departments fields in the list of composite records are $Null.
find all Managers (complete) Manage Employees
Lists all managers regardless of whether they currently have a staff.
See Also
ADD
CHANGE
COMPUTE
DELETE
FIND
LIST
REPORT FROM
SELECT
UNRELATED
UPDATE
USING
Marks the start of a comment in an application program.
Syntax
[ZIMcommand] % comment
Parameters
| ZIMcommand | Any portion of a command that appears on one line in an application program. |
| comment | Any string of characters, normally a few words explaining either ZIMcommand or an entire section of the program. The command parser ignores comment. |
Comments
The percent sign marks the start of a comment in an application program.
Example
% Process accelerators
form set (not scroll) fPlayers % switch off scrolling
case
when Event.EventName = "F3" % "Exit" accelerator
return % terminate main procedure
when Event.EventName = "F4" % "Update" accelerator
UpdatePlayers ()
when Event.EventName = "F5" % "Add" accelerator
AddPlayers (PlayersAdded)
when Event.EventName = "F6" % "Delete" accelerator
DeletePlayers (PlayersDeleted)
when Event.EventName = "F7" % "Report" accelerator
ReportPlayers ()
endcase
Transfers control to another procedure.
Syntax
TRANSFORM procedurename [(]expression[)]
Parameters
| procedurename | The name of the procedure to which execution control is to be transferred. |
| expression | Parameters or macros for procedurename (formatted as when calling the procedure). |
Comments
TRANSFORM transfers execution control to the specified procedure, but does not return control to the calling procedure once procedurename has finished executing. Control returns instead to the “parent” of the calling procedure.
Example
Consider the following sequence of procedures:
01 procedure Proc1 ( )
02 Proc2 ( ) (Control goes to line 12)
: … more commands …
10 endprocedure
11 %————————
12 procedure Proc2 ( )
13 transform Proc3 ( ) (Control goes to line 23)
: … more commands …
21 endprocedure
22 %———————–
23 procedure Proc3 ( )
24 … more commands …
25 endprocedure (Control goes to line 03)
The normal flow (without TRANSFORM) is Proc1 to Proc2 to Proc3 to Proc2 to Proc1.
The flow for calling with TRANSFORM is Proc1 to Proc2 to Proc3 to Proc1.
See Also
How To Call Procedures
RETURN
STOP
Returns the position of the current member of a result set.
Syntax
$currentmember(setname)
Parameters
| setname | a character string, or an expression that evaluates to a character string, being the name of a result set |
Return Value
Number, with no decimal places.
Comments
$currentmember returns the (numerical) position of the current member within the specified result set. To explicitly specify the current set, use “CurrentSet” (including the quotation marks), as CurrentSet is a reserved word and the function is expecting a character string.
To ensure against unexpected results, choose set names carefully. At run time, the software distinguishes sets only by their names, even if they are permanent set names created in different application directories.
If, for example, you produce a set called Set1 in directory PersonnelData, and later you produce another set called Set1 in directory TestData, the second version of Set1 replaces the first version. Function $currentmember works only on the most recent version of the set.
Example
let vMemberNum = $currentmember("Set1")If the current member of Set1 is the fifth member, then variable vMemberNum is set to 5.
while
... process current member ...
if $currentmember("TempSet") = $lastmember("TempSet")
break
endif
next TempSet
endwhileThe WHILE loop processes TempSet one member at a time, breaking out when the last member of the set has been processed.
See Also
$lastmember
Converts an ordinal number into a character.
Syntax
$tochr(number)
Parameters
| number | a number, or an expression that evaluates to a number |
Return Value
Each of the decimal numbers from 0 to 255 represents a character output by your workstation. $tochr converts a given number to the corresponding character.
Note: The ascii character 0 returns an ascii null value. Zim sees the null character as an End of Line character and stops outputting data. In addition, the ascii character 32 (a space) translates to a 0 since the $tochr function expects a number as the parameter. So, $tochr (” “) translates to $tochr(0) and results in the null value. No matter how encountered, a null value in a string truncates the string at the first null character encountered.
If number is negative or greater than 255, the result of the function is $Null.
The character produced by the $tochr function can be converted back to a decimal number by the $toord function.
Comments
Ordinal number refers to the decimal numbers 0 to 255 that you computer uses to represent the characters available on your system.
Example
$tochr(32)
Evaluates to a space (on ASCII machines).
$tochr($toord("Z"))Evaluates to “Z”.
See Also
$left
$substring
$toalpha
$todate
$tonumber
About Character Literals
About Functional Expressions
Conversion Between Data Types
Calculates a date value by adding years to (or subtracting years from) a specified date value.
Syntax
$addyears(date,number)
Parameters
| date | a date, or an expression that evaluates to a DATE data type |
| number | a number, or an expression that evaluates to a number |
Return Value
Number, representing a DATE value.
Comments
Use $addyears to perform arithmetic with date values. The $addyears function calculates a date value by adding a number representing years to a date value. If number is negative, the effect is to subtract the years from the date.
The + (add) and – (subtract) operators can be used to achieve the same results.
If date or the result of the $addyears expression is an invalid date (e.g., 19930231), it is adjusted to produce a valid date (e.g., 19930228).
Example
If $Date has the value 19981225, then
$addyears($date,5)
Evaluates to 20041225.
$addyears($date,-5)
Evaluates to 19931225.
$addyears(19980229,1)
Evaluates to 19990228.
See Also
$adddays
$addmonths
$addweeks
$todate
$weekday
$year
+ (Add/Positive)
– (Subtract/Negative)
About Functional Expressions
Arithmetic with Dates
Matches all subsequent characters in a value.
Syntax
expression1 = expression2 ?
Parameters
| expression1 | A character string, or a variable or form field that evaluates to a character string. |
| expression2 | A character string, or a variable or form field that evaluates to a character string. |
Comments
Used with the equals sign in logic expressions, the ? wildcard matches any number of subsequent characters when expression2 is compared to expression1. The question mark must appear outside of the pattern string.
Example
DeptNum = "D56"?
Logically true if the department number begins with the string “D56”. Notice that the question mark must appear outside the string.
RemarkField = "Smith?"
Shows the question mark being used literally in a string. (The characters appear inside the quotation marks.) The expression is logically true only if Remarkfield contains the exact characters Smith?.
Surname = fCustomer.LastName?
Shows how the wildcard can be attached directly to an atomic expression employing a variable, local variable, form field, or formal parameter, provided the object is of a character data type. (Trailing blanks in the specified object are trimmed for pattern-matching purposes.)
See Also
Conventions
How To Construct Logic Expressions
How To Use Logic Expressions