- This example of a computed field value performs an arithmetic
operation involving two other fields in the document. These fields
must exist in the document, must be numeric, and must be initialized
to a numeric value.
TotalSales - CostOfSales
- This agent example performs an arithmetic operation on two fields
in the current document, and assigns the result to a third field.
The two referenced fields must exist; GrossSales can be new.
FIELD GrossSales := TotalSales - CostOfSales;
SELECT @All
- This agent example performs an arithmetic operation on two fields
in the current document, and either assigns the value to a third field
or sends a mail message. The first statement initializes GrossSales
and is not necessary if you are certain the field already exists.
FIELD GrossSales := 0;
gs := TotalSales - CostOfSales;
@If(gs > 0; @SetField("GrossSales"; gs); @MailSend("Ian Perron"; ""; ""; "No gross sales"; "Gross sales are zero or less for "; Subject));
SELECT @All
- This column formula example evaluates to the value of KeyThought
for documents that contain that field. If a document does not contain
a KeyThought field, it "defaults" to the value of Topic.
DEFAULT KeyThought := Topic;
KeyThought
- This is another way of coding the preceding example.
@If(@IsAvailable(KeyThought); KeyThought; Topic)
- This agent example deletes the GrossSales field.
@If (@IsUnavailable(GrossSales); @Return(""); "");
FIELD GrossSales := @DeleteField;
SELECT @All
- This agent example calculates the GrossSales field, then displays
the result and does not mark the document for update. As a result,
no change takes place in the document in storage. The changes are
saved if @DocMark is omitted or "@DocMark([Update])" is specified.
FIELD GrossSales := TotalSales - CostOfSales;
@Prompt([Ok]; "Gross sales for " + Subject; @Text(GrossSales));
@DocMark([NoUpdate]);
SELECT @All
- This example displays all the fields in the current document.
@Prompt([OkCancelList]; "Fields"; "Fields in document"; ""; @DocFields);
SELECT @All
- This window title formula displays "New Document" for a new document.
For an existing document, the formula displays the Subject field and
the number of responses.
@If(@IsNewDoc; "New Document"; Subject + " with " + @Text(@Responses) + " response(s)")
- This view selection formula selects all documents except those
for which the Form field contains "Profile" or "Log."
SELECT !@Contains(Form; "Profile" : "Log")
- This view selection formula selects all documents for which the
Subject field contains "acme" in any case, plus all their descendants.
SELECT @Contains(@LowerCase(Subject); "acme") | @AllDescendants
- This form action formula displays the names and lengths of all
attachments in a document, or "No attachments" if the document has
no attachments.
@If(@Attachments > 0; @Prompt([OkCancelList]; "Attachments"; "Attachment names and lengths"; ""; @AttachmentNames + " (" + @Text(@AttachmentLengths) + " bytes)"); @Prompt([Ok]; "Attachments"; "No attachments"))
- This onHelp event returns the name, row, and column of a table
that is currently in focus.
row := @GetFocusTable([CellRow]);
@If(row = "0"; @Prompt([Ok]; "*No table*"; "Not in a table");
@Do(
column := @GetFocusTable([CellColumn]);
name0 := @GetFocusTable([TableName]);
name := @If(name0 = ""; "No name"; name0);
@Prompt([Ok]; "*" + name + "*";
"Row " + row + ", column " + column)))