Working with Crosstab Table Columns
Instead of using the wizard, developers can manually build crosstab tables using two types of crosstab table columns: Label Columns and Value Columns. Crosstab tables have one Label Column by default; the number of Value Column cells is determined by the number of Crosstab Column values.
Here's how to add a Crosstab Table Label column:
- As shown above, in Logi Studio, select the parent Crosstab Table element and add a Crosstab Table Label Column element beneath it. Configure any of its optional attributes.
- Then, add a Label element beneath the new column and use a regular @Data token to reference values from a column returned by the datalayer.
Next, we want to add Crosstab Table Value Columns elements to create the Value columns for the crosstab table. Value columns contain the results of the aggregations of the data from the specified column.
But the results of the aggregations do not appear in the datalayer under any of its column names, so how is it referenced? Special @Data tokens allow you to access Crosstab column and Value data. Here are the tokens:
These special tokens are:
- @Data.rdCrosstabColumn~ - Returns the values in the specified Crosstab Column
- @Data.rdCrosstabValue~ - Returns the aggregated values in the specified Value Column
- @Data.rdCrosstabValCount~ - Returns the number of corresponding records from the Value Column used to calculate the current aggregate value if the aggregation is Sum, Count, or Average.
Let's add a Value Column and set its attributes using the special tokens:
- Beneath the Crosstab Table element, add a Crosstab Table Value Columns element, as shown above.
- We want to use data in the column headers, so set the element's Column Header attribute to one of the special tokens: @Data.rdCrosstabColumn~.
- Add a Label element beneath the Crosstab Table Value Columns element and set its Caption attribute to @Data.rdCrosstabValue~, as shown above, to display the aggregated crosstab values.