TRVRowGenerationRule.CopyFirstCol, CopyColCount, CopySpacingColCount, CopyMaxCount

<< Click to display table of contents >>

TRVRowGenerationRule.CopyFirstCol, CopyColCount, CopySpacingColCount, CopyMaxCount

The properties defining table columns copying.

property CopyFirstCol: Integer;
property CopyColCount: Integer;
property CopySpacingColCount: Integer;
property CopyMaxCount: Integer;

These properties are used only if the table is not used for building a cross-tab report, i.e. if its CrossTabulation.Levels.Count = 0.

Columns copying is activated only if CopyColCount > 0. If it is activated, data are propagated from left to right (by copying content), then from top to bottom (by adding rows).

There is an important difference between a columns copying and an application of the rule to rows: when applying the rule to table rows, new rows are added; when copying columns, contents of the source cells are copied to existing cells, without adding new columns.

The source cells are defined as cells in the intersection of rows from FirstRow to FirstRow+RowCount-1, and columns from CopyFirstCol to CopyFirstCol+CopyColCount-1. These cells are copied to columns to the right, leaving CopySpacingColCount columns between copies. The number of copies is calculated automatically. If CopyMaxCount > 0, it defines the maximal possible count of copies (per a group of rows).

The following cases are not considered as errors (the rule is applied ignoring these properties):

CrossTabulation.Levels.Count > 0

incorrect values of these properties, if CopyColCount <= 0.

The following cases are considered as errors (the rule is not applied):

incorrect values of properties (specifying indexes of columns outside the table)

only one instance of repeated cells (i.e. only source cells, so no copying can occur; because of it, you cannot assign CopyMaxCount = 1, the minimal valid value is 2).

incorrect structure of the source cells (if some cells intersect the range of the main cells' rows and columns because of cell merging)

incorrect structure of destination cells (every destination cell must have the same values of ColSpan and RowSpan properties as the corresponding source cell)

If CopyColCount > 1, SubRules are not applied.

Examples

 

Example 1: the simplest case, labels for a cookbook.

Column 1

Column 2

{Label}


Let this table has a rule with the properties: FirstRow = 1, RowCount = 1, CopyColCount = 1, all other Copy* properties are zeros.

Let the data query for this rule returns records having the following values in the 'Label' field: 'Soups', 'Salads', 'Main Dishes', 'Cakes', 'Beverages'.

The result is:

Column 1

Column 2

Soups

Salads

Main Dishes

Cakes

Beverages


Example 2:

Staff

 

{Name}

 

empty

 

empty

 

{Title}

Phone: {Phone}





Let this table has a rule with the properties: FirstRow = 1, RowCount = 2, CopyColCount = 1, CopyFirstCol = 1, CopySpacingColCount = 1

Let the data query for this rule returns records about 5 persons: Alice, Bob, Carol, Dave, Eve.

The result is:

Staff

 

Alice

 

Bob

 

Carol

 

Director General

Phone: 123456

Director (Development)

Phone: 234567

Director (Planning)

Phone: 345678

 

Dave

 

Eve

 

empty

 

Director (Finance)

Phone: 456789

Internal Auditor

Phone: 567890

 

 

Data fields in other cells

The rest of cells belonging to the rule (cells to the left of the source cells, cells to the right of the last copy, cells between copies) may also contain data fields. The report generator fills them in the following way:

the leftmost cells are filled using data from the record corresponding to the leftmost copy;

the rightmost cells are filled using data from the record corresponding to the rightmost copy;

cells between copies are filled using data from the record corresponding to the copy to the left of them.

The table below shows record indexes used to fill the table from the previous example:

this cell does not belong to the rule

0

0

0

1

1

2

2

0

0

1

1

2

2

3

3

3

4

4

4

4

3

3

4

4

4

4

 

Default values:

0

See also

Definitions of Report Workshop terms