APPLICATION DESIGN


Examples: Calculating a value for a computed field
Combining text and field values to create a message
The SchedDisp field, which displays only when users read or print a document, can display two different messages depending on the value in the Sched field. If it is a special, temporary schedule, the message combines words with a text-based version of the value in the Date field. If the schedule is permanent, the message is "Regular schedule."

@If(Sched = "Special schedule"; "Special schedule for week starting: " + @Text(Date); "Regular schedule")

Totaling monthly budget figures
The MonthlyTotal field in the Budget form is a computed Numbers field that is formatted for Currency with two decimal places. The formula totals the values in each category to calculate the total budget.

Advertising + Entertainment + Miscellaneous + Overhead + Salaries + Travel

Subtracting, multiplying, and dividing in computed number fields
When you design a computed number field to subtract or multiply editable fields on a form, give each editable field a default value of zero.

When you design a computed number field to divide editable fields, give each editable field a default value of zero and use the following formula to perform division in the computed number field:

FIELD DivisorFieldName := DivisorFieldName;

@If(@IsNewDoc & !@IsDocBeingRecalculated; (DividendFieldName / (DivisorFieldName + 1));(DividendFieldName / DivisorFieldName))

Storing the date and time a document is created
IBM® Lotus® Notes® automatically uses internal fields to store the date and time a document is created. To display this information, define a Time field that is computed-when-displayed, and then write this formula for it:

@Created;

The field is defined as computed-when-displayed, rather than computed, to avoid storing the creation date information twice.

Determining the normal work day age of a document
This field formula determines the age of a document in work days, based on a five-day work week. In the following example:


See Also