COMPUTE

COMPUTE

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

COMPUTE

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

Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Leave a Reply

Your email address will not be published. Required fields are marked *

en_CAEnglish