TRVCrossTabLevel.CaptionFieldName

<< Click to display table of contents >>

TRVCrossTabLevel.CaptionFieldName

A name of data field that can be used to show captions of cross-tab columns.

property CaptionFieldName: TRVUnicodeString;

If this property is not empty, it defines an alternative caption for columns of this level of the cross-tab table. This caption can be displayed (see cross-tab heading field syntax).

This property is used if TRVReportTableItemInfo.CrossTabulation.ColumnGenerationType is one of:

rvcgtDataQuerySeparate

rvcgtDataQueryCascade.

rvcgtAutoSeparate

rvcgtAutoGroup

This property is useful if FieldName field contains some identifier, while a text description is stored in another field.

If SortType = rvrstCaptionsAscending or rvrstCaptionsDescending, and TRVReportTableItemInfo.CrossTabulation.ColumnGenerationType = rvcgtAutoSeparate or rvcgtAutoGroup, captions are used when sorting columns at this level of cross-tab (see also CaseSensitive property).

Example

A data table for a cross-tab report is named "OrdersTable", it has fields: OrderId, ItemId, Quantity.

There is another table "ItemsTable", it has fields: ItemId, ItemName.

We want to build a cross-tab report that uses ItemId for cross-tab columns, but we want to display ItemName in the table header.

The simplest example of a template table for this report is below:

Order

{#ItemName}

N {OrderID}

{Quantity}

Table.CrossTabulation.ColumnGenerationType := 

  rvcgtDataQuerySeparate;
Table.CrossTabulation.Column := 1;
Table.CrossTabulation.FirstRow := 0;
with Table.CrossTabulation.Levels.Add do
begin
  DataQuery :=

    'SELECT ItemId, ItemName FROM ItemsTable ORDER BY ItemName';
  FieldName := 'ItemId';
  CaptionFieldName := 'ItemName';
end;
with Table.RowGenerationRules.Add do
begin
  FirstRow := 1;
  RowCount := 1;
  DataQuery := 'SELECT * FROM OrdersTable';

  KeyFieldNames := 'OrderId';
end;

The resulting report table looks like:

Order

Item A

Item B

Item C

N 10001

1

2

3

N 10002

3

3

3

N 10003

4

1

1

N 10004

2

3

3

Default value:

'' (empty string)

See also

Definitions of Report Workshop terms