Any slot in a PipeDream document can be designated as an expression slot, in which case the expression you type into it will be evaluated, and the result will be displayed in the corresponding position in the document.
An expression is entered by giving the Edit Expression command on the EDIT menu, or by typing X. The cursor will then move to the editing line, at the top of the screen, until the expression is entered by typing
Alternatively, if the Options Page Text/Numbers option is set to N, all entries are taken as expressions.
Expressions
Expressions can consist of numbers, functions performing operations on other expressions, references to other slots, or a combination of these combined by mathematical operators. Expressions can give a numerical result, a date, or a string of text. Illegal expressions will give an error as their result.
Numbers
Numbers can be expressed in normal notation, or scientific notation. For example,
1, -1.7632, 1.4e27, 0.001
All calculations are performed to an accuracy of nine decimal places and numbers may lie between 1e38 and 1e-38.
Strings
Strings are entered between double quotes, and may contain spaces. A slot reference to a text slot returns a string.
Slot references
The form of a slot reference is
column-label row-number
separated by optional spaces, where
column-label designates one of the 64 columns, A to Z, followed by AA to BN, and
row-number is from 1 to 32768.
Slot references are normally 'relative'; the reference will be updated if the position of the slot containing the reference changes relative to other slots.
Each half of the slot reference may be 'fixed' by preceding the column letter or the row number by a dollar sign. The possibilities are:
A1 | normal reference |
$A1 | fixed column reference |
A$1 | fixed row reference |
$A$1 | fixed column, fixed row |
The fixed part of a reference is not altered when copied with the Replicate or Copy commands on the BLOCKS menu, or when placed in a selection expression for the Save and Print commands on the FILES and PRINT menus respectively.
When a slot to which a slot reference refers is deleted, the slot reference is marked with a '%' sign to indicate that the reference is no longer valid. The expression containing the slot reference will display the Badslot error message.
Specifying a block of slots - Ranges
You can perform some functions on a block of slots, specified by the top left-hand corner of the block followed by the bottom right-hand corner of the block.
For example
A2 D8
specifies all the slots in the block between columns A and D, and rows 2 and 8 inclusive.
In some cases the function only makes sense if the range is restricted to a single row (a 'row range') as in A1 D1, or a single column (a 'column range'), as in B8 B20.
Specifying several slots - Lists
Functions are available to count, choose from, or find the maximum or minimum of a list of elements. The elements in a list are separated by commas and can be simple slot references, or ranges. Each slot in a range is considered as a separate list element. For example,
13, B1 B5, C7,
is a list containing the 7 elements 13, B1, B2, B3, B4, B5, and C7.
Dates
Dates are entered in the format
DD.MM.YYYY or MM.DD.YYYY
depending on whether the Panel date-format setting is European or American.
Dates can be sorted into chronological order, and the functions DAY, MONTH, and YEAR can be used to extract the values of the date's day, month, and year respectively.
Operators
The following operators can be used within expressions
Arithmetic
The arithmetic operators take two numbers as operands.
+ | add | - | subtract |
* | multiply | / | divide |
^ | raise to the power |
Also, '+' and '-' may be used on date values. For example
12.10.1987 + 127
will return the date 127 days after 12 October 87, or 16.2.88, assuming that European date format has been selected.
Relational
The relational operators can compare dates, strings, and numbers. Both operands must be of the same type, and the result is a logical value of FALSE=0 and TRUE=1.
< | less than | = | equal to |
<= | less than or equal to | > | greater than |
<> | not equal to | >= | greater than or equal to |
When strings are being compared, the following wildcards (as in the Replace command) can be included in the second string:
^? | matches any single character |
^# | matches any number of characters |
^^ | represents ^ |
Logical
The logical operators operate on numeric or logical values. Boolean FALSE is taken as zero, TRUE as non-zero.
& | AND | ¦ | OR |
! | unary NOT |
Functions
ABS | Absolute value |
---|---|
ABS(number) Returns the absolute positive value of the argument. | |
ACS | Arc cosine |
ACS(number) Returns the arc cosine of the argument, in radians. | |
ASN | Arc sine |
ASN(number) Returns the arc sine of the argument, in radians. | |
ATN | Arc tangent |
ATN(number) Returns the arc tangent of the argument, in radians. | |
CHOOSE | Choose element from list |
CHOOSE(list) Returns an element from the list, using the value of the first element as an index into the remaining elements. For example, if
gives the result | |
COL | Column |
COL The value of the column in which it is evaluated. Column A is 1, column B is 2, etc. | |
COS | Cosine |
COS(radians) Returns the cosine of the argument. | |
COUNT | Count the number of elements |
COUNT(list) Returns the number of non-blank slots in the list. | |
DAY | Day of date |
DAY(date) Returns the day number of a date argument. For example, if slot | |
DEG | Degrees from radians |
DEG(radians) Converts the argument, taken in radians, into degrees. | |
EXP | Exponent |
EXP(number) Returns the constant e (2.71828184..) raised to the specified power. | |
IF | Conditional expression |
IF(boolean,then,else) If the value of the first argument is TRUE, ie non-zero, the function returns then; otherwise the function returns else. For example, if slot A1 contains
would return Debit. | |
INDEX | Index slot |
INDEX(column,row) Returns the evaluated expression or string found at coordinates column, row. For example, if
would return | |
INT | Integer part |
INT(number) Returns the integer part of the argument. | |
LN | Logarithm to base e |
LN(number) Returns the natural logarithm, loge of the argument. | |
LOG | Logarithm to base 10 |
LOG(number) Returns the logarithm to base 10 of the argument. | |
LOOKUP | Look up value in a table |
LOOKUP(key,range1,range2) Returns the value in range2 corresponding to the position that key occurs in range1. key must be a cell reference. For example, the following sheet would result if If an exact match is found in range1, the function returns the value of the slot the same number of slots from the beginning of the second range. If key is not found in range1, the function returns the error Lookup Wildcards '^?' and '^#' may be included in key. | |
MAX | Maximum value in list |
MAX(list) Returns the maximum value from the slots in the list. | |
MIN | Minimum value in list |
MIN(list) Returns the minimum value from the slots in the list. | |
MONTH | Month of date |
MONTH(date) Returns the month number of its date argument. For example, if | |
PI | π |
PI Returns the value 3.141592653. | |
RAD | Radians from degrees |
RAD(degrees) Returns the argument, taken as degrees, converted into radians. | |
ROW | Row |
ROW The value of the row in which it is evaluated. | |
SGN | Sign |
SGN(number) Returns -1, 0, or 1 depending on whether the argument is negative, zero, or positive respectively. | |
SIN | Sine |
SIN(radians) Returns the sine of the argument, in radians. | |
SQR | Square root |
SQR(number) Returns the positive square-root of its argument. | |
SUM | Sum |
SUM(list) Returns the sum of the slots in the list. | |
TAN | Tangent |
TAN(radians) Returns the tangent of the argument, in radians. | |
YEAR | Year of date |
Returns the year number of its date argument. For example, if |
@ Fields
You can include the page number, the date, the file title from the Options Page, or the value of any expression slot within text in your document using the special PipeDream @-fields.
The following @ fields are available:
Identifier | Effect |
@P@ | current page number |
@D@ | date |
@T@ | title defined in options page |
@ref@ | value of slot ref |
@@ | @ |
One or more '@' characters should be given after the identifier to determine the size of the @ field for formatting. For example,
@P@@@@
creates a field of four characters. Provided the value to be displayed is less than the size of the @-field, the line will be justified correctly.
The field:
@ref@@@@@
will reserve five characters for the value of the slot indicated by the reference.
If it is an expression slot, the value will be displayed in the same format as in the slot itself, with alignment ignored.
When the cursor is not on a text slot with an @ field in it, the slot shows the value of the @ field. When the cursor is moved onto the slot, the actual @ identifier is shown, for editing.