reportTable
A Word content command that brings the contents of a Report Data value into a table within its host Content control.
Table structure
The reportTable
command expects its Content control's table to have a certain amount of rows corresponding to the kind of report the Report Data value describes. The rows are used as models for producing the different grouping and detail rows, meaning that all the record detail rows, for example, will be exact copies of the detail row model in all but the dynamic content in their cells.
Regardless of the report, the first row of the table is treated as a header row and is not modified by the command in any way. Otherwise, the amount of required rows varies from one to four, depending on the type of the report and this command's attributes:
If the report is in the Summary format, the table should have one model row for every level of grouping in the report. The topmost row of these is for the highest grouping level. There may be one to three groupings, so as many possible rows.
IfshowDetails
is undefined or resolves intotrue
, one additional model row for the record details is needed. This row is to follow the grouping rows.
IfshowTotal
is undefined or resolves intotrue
, one additional row is needed for the grand totals. This row should follow the details row.If the report is in the Tabular format, the attributes fully control what, if anything, appears in the table. If both of them resolve into
true
, at least two rows are needed.
IfshowDetails
is undefined or resolves intotrue
, all but the last row of the table are model rows for the record details. It is therefore possible to have the details of each record take multiple rows. There should be at least one row for this.
IfshowTotal
is undefined or resolves intotrue
, the last row of the table is used for grand totals.
If the amount of rows is not correct, an error telling the expected number will appear upon evaluation.
Displaying the report data
During the production of all the grouping and detail rows, variables containing specific parts of the Report data corresponding to the currently processed row can be accessed. These variables are described below.
In each of the grouping rows, a variable containing a Report Data - Group Container value of that grouping level may be accessed. The name of that variable is either gr1
, gr2,
or gr3
, the first being for the highest grouping level and the last for the lowest level. So, to display the label and value of the highest grouping for example, use expressions like ${gr1.label}
and ${gr1.preformatted}
or ${gr1.value}
in cells of that grouping's model row.
In each of the detail rows, a variable containing a Map of the column values as Report Data - Value Container values may be accessed. The name of that variable is set
and the keys are labels and Report API names of the fields. The labels are the column labels you can see in Salesforce's rendition of the reports, such as "Opportunity Name" and "Probability (%)", but do note that these are localized and therefore vary between users of different languages. Use expressions like ${det['AMOUNT'].value}
and ${det['PROBABILITY'].preformatted}
in the detail row model's cells to display the detail values. The keys like "AMOUNT" can be best found using the Debug View, as it allows you to inspect the contents of the Report Data value.
In the row for grand totals, a variable containing the Report Data - Group Container value for the grand totals may be accessed with the variable name tot
. This value only contains the label
and aggregates
data entries. For example, an expression like ${tot. label} (${tot. aggregates['RowCount']} records)
could resolve into "Grand Totals (196 records)".
This command has a priority of 90.
Syntax:
reportTable(value,showDetails,showTotal)
With required attributes only:
reportTable(value)
Attributes
value | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | Report Data | Yes |
Defines the data whose contents this command is processing. |
showDetails | ||
---|---|---|
Required | Value type | EL-evaluated |
No | Boolean | Yes |
Defines if the detail rows of the report will be displayed. If this attribute's value resolves into If undefined, the value of |
showTotal | ||
---|---|---|
Required | Value type | EL-evaluated |
No | Boolean | Yes |
Defines if the total row of the report will be displayed. If this attribute's value resolves into If undefined, the value of |
Examples
The reportTable
command itself is easy to set up, as just providing it a variable holding a Report Data value is enough. The possible questions are more likely to appear with coming up with the expressions needed to display the data. The screenshot below displays a Summary and a Tabular report of Opportunity records with both having the columns Opportunity Name, Amount, and Probability, and both details and grand totals included. The command for both of these can be as simple as this:
reportTable(oppReport)
As can be seen, the structure of these tables is otherwise the same except that the Summary table has three additional rows for its three levels of grouping (the rows of varying shades of green). The other three rows present in both tables are the header (black row), the details row (white row), and the grand totals (yellow row). While inline EL expressions have been used in this example, it is also possible to use the out command to print out the values.
![](../__attachments/156893652/output-record.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)