A grid-function field is a new field whose values are computed
programmatically,
by using
the other values which are already in the ReportGrid. This functionality
is similar to Excel formulas, but more powerful. The function (called "Grid
function") to compute
the new values can be any VB.net code. It can also be written within (Microsoft) Visual studio and
then pasted into DataTime. It can be formed by multiple function. The only requirement
is that the main function has the given expected signature, shown in the sample function provided
by DataTime.
Note that when a function can be computed at the extraction time, it is always better
to define it within the Data Source, thus avoiding the definition of a grid function.
Also note that there is a big conceptual difference between aggregate functions
and grid functions. The aggregate functions are computed by record aggregation,
while the Grid functions are computed
by using the cell values only,
and they are not "aware" of the records.
Writing a function is very simple, especially if you are already a VB.NET programmer.
You just need to remember that
cell.Field("FieldName")
is the value of the cell which is aligned to the current cell but in the
field called "FieldName". The name and argument of the function in code cannot be
changed, the return type can be adjusted according to your needs (or you can just
use the "object" type).
When you define a Grid-function field, you have to imagine a new field and an iteration
on the cells of this new field. On each cell the cell value will be computed according
to the code you provide.
Here is your new Grid-function field:
TOTALS
On grid function you can define (possibly multiple) totals. Total can be defined in several ways:
1. Totals computed aggregating values contained in the cells
1.1 Using Predefinite aggregate function
1.2 Using Custom aggregate functions (you provide
the source code)
The predefinite aggregate functions contains several possibility. The most common
is clearly the
SUM.
If you feel some predefinite functions are missing please, ask: there will be readily
added for you.
Using a
custom aggregate function requires programming skill and
understanding of what you are doing. On the other hand it opens to endless possibilities.
For any doubt or assistance, please post on our newsgroup.
2. Totals computed through another grid function.
This is less common scenario. It is however envisioned, for maximum generality. In such case the total is obtained through the computation of a grid function, where the code is provided by the user.