FlowFields are a powerful feature of the C/SIDE database system, and strongly influence the way C/SIDE applications are designed. FlowFields and the underlying concept of SumIndexFields increase performance in activities such as calculating the balance of your customers. In traditional database systems, this involves a series of accesses and calculations before a result is available. With FlowFields, the result is immediately available.

FlowFields are not a permanent part of the table data. A FlowField can be thought of as a virtual field, which is an extension to the table data. Because the information in FlowFields exists only at run time, values in FlowFields are automatically initialized to 0 (zero). To update a FlowField, use the C/AL function <Record>.CALCFIELDS. If a FlowField is the direct source expression of a control on a form, the FlowField will automatically be calculated when the form is displayed.

FlowField Types

There are seven types of FlowFields. Each is described in the following table.

FlowField type Field type Description

Sum

decimal

The sum of a specified set within a column in a table.

Average

decimal

The average value of a specified set within a column in a table.

Exist

Boolean

Indicates whether any records exist within a specified set in a table.

Count

integer

The number of records within a specified set in a table.

Min

any

The minimum value in a column within a specified set in a table.

Max

any

The maximum value in a column within a specified set in a table.

Lookup

any

Looks up a value in a column in another table.

Example

Consider the Customer table in the following illustration. This table contains two FlowFields. The field named Any Entries is a FlowField of the Exist type, and the Balance field is a FlowField of the Sum type.

The figure shows that the value in the Balance FlowField for customer number 10000 (Windy City Solutions) is retrieved from the Amount column in the Customer Entry table. The value is the sum of the amount fields for the entries that have the customer number 10000.

  CopyCode imageCopy Code
Sum = 10 + 20 + 30 = 60.

The values shown in the Balance column in the Customer table for customers 10010, 10020, and 10040 are found in the same way. For customer number 10030 the value is 0 (zero), as there are no entries in the Customer Entry table that have a Customer No. that equals 10030.

In this example, the Balance FlowField in the Customer table reflects the sum of a specific subset of the Amount fields in the Customer Entry table. How the calculation of a FlowField is to be made, is defined in a calculation formula. The calculation formula for the Balance field is:

  CopyCode imageCopy Code
Sum("Customer Entries".Amount WHERE(CustNo=FIELD(CustNo)))

Correspondingly, the Any Entries field, which indicates whether any entries exist, has the following definition:

  CopyCode imageCopy Code
Exist("Customer Entries" WHERE(CustNo=FIELD(CustNo)))

See Also