<< Click to display table of contents >> TRVRowGenerationCustomRule.SubRules |
A collection of nested rules for this rule.
property SubRules: TRVRowGenerationNestedRules;
Nested rules are applied only if:
•if cross-tabulation is not defined (i.e. the table's CrossTabulation.Levels.Count = 0)
•copying is not defined in the rule (i.e. CopyColCount = 0).
Nested rules allow applying data queries to [parts of] rows belonging to this rule.
Rows of nested rules must be included in rows of this rule. Rows of nested rules must not overlap with each other.
Let we have the table "Product" having the fields "Category" and "Product". The table template is:
with Table.RowGenerationRules.Add do begin FirstRow := 1; RowCount := 2; DataQuery := 'SELECT Category FROM Products'; with SubRules.Add do begin FirstRow := 1; // the actual first row is 1 + 1 = 2 RowCount := 1; DataQuery := 'SELECT Product FROM Products WHERE Category=''{Category}'''; end; end; As you can see, all two green rows belong to the parent rule, and the light green row also belongs to the nested rule. The result would be like this:
|
The same data as in the example 1, but a different report layout. The table template is:
with Table.RowGenerationRules.Add do begin FirstRow := 1; RowCount := 1; DataQuery := 'SELECT Category FROM Products'; with SubRules.Add do begin FirstRow := 0; // the actual first row is 1 + 0 = 1 RowCount := 1; SkipLeftColCount := 1; DataQuery := 'SELECT Product FROM Products WHERE Category=''{Category}'''; end; end; As you can see, all two green cells belong to the parent rule, and the light green cell also belongs to the nested rule. The result would be like this:
|
The report generator processes rules and also cells of report tables.
The order of processing is the following:
1.the first sub-rule (rows are replicated)
2.cells belonging to the first sub-rule's replicated fragment, i.e. all cells between its SkipLeftColCount and SkipRightColCount columns;
3.other cells of the first sub-rule, i.e. all cells of the outermost SkipLeftColCount and SkipRightColCount columns;
4.the same for the second sub-rule, and so on
5.cells of this rule, not belonging to sub-rules