FieldClass - FlowField

FlowField must be dynamically calculated. FlowFields are virtual fields stored as metadata; they do not contain data in the conventional sense. A FlowField contains the definition of how to calculate (at runtime) the data that the field represents and a place to store the result of that calculation. Generally, the Editable property for a FlowField is set to No.

Depending on the CalcFormula method, this could be a value, a reference lookup, or a Boolean value. When the CalcFormula method is Sum, the FieldClass property connects a data field to a previously defined SumIndexField in the table defined in CalcFormula. FlowField processing speed will be significantly affected by the key configuration of the table being processed. While we must be careful not to define extra keys, having the right keys defined will have a major effect on system performance, and thus on user satisfaction.

A FlowField value is always 0, blank or false, unless it has been calculated. If a FlowField is displayed directly on a page, it is calculated automatically when the page is rendered. FlowFields are also automatically calculated when they are the subject of predefined filters as part of the properties of a data item in an object (this will be explained in more detail in the discussions in Chapter 5, Queries and Reports on Reports and Chapter 8, Advanced NAV Development Tools on XMLports). In all other cases, a FlowField must be forced to calculate using the C/AL RecordName.CALCFIELDS(FlowField1, [FlowField2],...) function or by use of the function SETAUTOCALCFIELDS. This is also true if the underlying data is changed after the initial display of a page (that is, the FlowField must be recalculated to take a data change into account).

Because a FlowField does not contain actual data, it cannot be used as a field in a key; in other words, we cannot include a FlowField as part of a key. Also, we cannot define a FlowField that is based on another FlowField except in special circumstances.

When a field has its FieldClass property set to FlowField, another directly associated property becomes available: CalcFormula (conversely, the AutoIncrement, and TestTableRelation properties disappear from view when FieldClass is set to FlowField). CalcFormula is the place where we can define the formula for calculating the FlowField. On the CalcFormula property line, there is an ellipsis button. Clicking on that button will bring up the following screen:

Click on the drop-down button to show the seven FlowField methods:

The seven FlowFields are described in the following table:

FlowField method

Field data type

Calculated Value as it applies to the specified set of data within a specific column (field) in a table

Sum Decimal The sum total
Average Decimal The average value (the sum divided by the row count)
Exist Boolean Yes or No / True or False - does an entry exist?
Count Integer The number of entries that exist
Min Any The smallest value of any entry
Max Any The largest value of any entry
Lookup Any The value of the specified entry

The Reverse Sign control allows us to change the displayed sign of the result for FlowField types Sum and Average only; the underlying data is not changed. If a Reverse Sign is used with the FlowField type Exist, it changes the effective function to does not Exist.

Table and Field allow us to define the Table and the Field within that table to which our Calculation Formula will apply. When we make the entries in our Calculation Formula screen, there is no validation checking by the compiler that we have chosen an eligible table with a field combination. That checking doesn't occur until runtime. Therefore, when we are creating a new FlowField, we should test it as soon as we have defined it.

The last, but by no means the least significant, component of the FlowField calculation formula is Table Filter. When we click on the ellipsis in the Table Filter field, the window shown in the following screenshot will appear:

When we click on the Field column, we will be invited to select a field from the table that was entered into the Table field earlier. The Type field choice will determine the type of filter. The Value field will have the filter rules define on this line, which must be consistent with the Type choices described in the following table:

Filter type Value Filtering action OnlyMax - Limit Values - Filter
Const A constant which will be defined in the Value field Uses the constant to filter for equally valued entries
Filter A filter which will be spelled out as a literal in the Value field Applies the filter expression from the Value field
Field A field from the table within which the FlowField exists Uses the contents of the specified field to filter for equally valued entries False False
If the specified field is a FlowFilter and the OnlyMaxLimit parameter is True, then the FlowFilter range will be applied on the basis of only having a MaxLimit, that is, having no bottom limit. This is useful for the date filters for Balance Sheet data. (For an example, see Field 31 - Balance at Date in Table 15 - G/L Account) True False
Causes the contents of the specified field to be interpreted as a filter (For an example, see Field 31 - Balance at Date in Table 15- G/L Account for an example) True or False True
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.133.96