Templates
Report Templates
to format report data within a report template, you must add a table definition to your document within that table definition, you'll add special tokens to indicate the type of table, the type of rows, and the placement for the data values all tokens should be surrounded by curly brackets {{ }} report templates can contain any other standard components that you can normally add to a word or excel file such as a header, footer, page numbers, etc table types the first token that is required is the table type token unaric reports currently supports two types of tables type 1 and type 2 to mark a table as a type 1, you would include the {{type1}} token for classic and {{lightning type1}} for lightning in the first row to mark a table as a type 2, you would include the {{type2}} token for classic and {{lightning type2}} for lightning in the first row type 1 type 1 tables are the simpler of the two types because they consist of just one column this single column is used to specify the format for each type of row and location of data values this means that templates that contain a type 1 table definition can be used across multiple reports however, they don't allow you to fully control the table output; for example, you can't do things like setting a specific width for each column type 2 with type 2 tables, you include a column for every column in the report this takes a little more work to set up and it ties the template to a single report (really to a single set of report columns) however, it gives you full control over the table, enabling you to perform many advanced tasks such as setting an exact width and alignment for each column, applying custom formatting to specific columns, etc template examples word (docx) examples https //reportbuilder cloud4j com/lightning%20table%20type%201%20 %20minimum docx https //reportbuilder cloud4j com/lightning%20table%20type%201%20 %20full docx https //reportbuilder cloud4j com/lightning%20table%20type%202%20 %20minimum docx https //reportbuilder cloud4j com/lightning%20table%20type%202%20 %20full docx https //reportbuilder cloud4j com/lightning%20table%20type%202%20 %20field%20values docx https //reportbuilder cloud4j com/table%20type%201%20 %20minimum docx https //reportbuilder cloud4j com/table%20type%201%20 %20full docx https //reportbuilder cloud4j com/table%20type%202%20 %20minimum docx https //reportbuilder cloud4j com/table%20type%202%20 %20full docx https //reportbuilder cloud4j com/table%20type%202%20 %20full%20(all%20variables) docx https //reportbuilder cloud4j com/table%20type%202%20 %20field%20values docx excel (xlsx) examples https //reportbuilder cloud4j com/lightning%20table%20type%201%20 %20minimum%20 %20excel xlsx https //reportbuilder cloud4j com/lightning%20table%20type%201%20 %20full xlsx https //reportbuilder cloud4j com/lightning%20table%20type%202%20 %20minimum%20 %20excel xlsx https //reportbuilder cloud4j com/lightning%20table%20type%202%20 %20full xlsx https //reportbuilder cloud4j com/lightning%20table%20type%202%20 %20field%20values xlsx https //reportbuilder cloud4j com/table%20type%201%20 %20minimum%20 %20excel xlsx https //reportbuilder cloud4j com/table%20type%201%20 %20full%20 %20excel%20(chart) xlsx https //reportbuilder cloud4j com/table%20type%202%20 %20minimum%20 %20excel xlsx https //reportbuilder cloud4j com/table%20type%202%20 %20full%20 %20excel%20(chart) xlsx https //reportbuilder cloud4j com/table%20type%202%20 %20field%20values xlsx available tokens row types row type tokens are used to indicate the type of row row type token description {{header row}} the header row contains the column headers {{grouping1 row}} contains the 1st level grouping value, for example, type abc (10 records) {{grouping1 value}} contains the 1st level grouping value (lightning only), for example, abc (10) {{grouping1 value only}} contains the 1st level grouping value only (lightning only), for example, abc {{grouping1 aggregate row}} contains the 1st level numeric aggregate information, for example, avg $100,000 {{grouping2 row}} contains the 2nd level grouping value, for example, type abc (20 records) {{grouping2 value}} contains the 2nd level grouping value (lightning only), for example, abc (20) {{grouping2 value only}} contains the 2nd level grouping value only (lightning only), for example, abc {{grouping2 aggregate row}} contains the 2nd level numeric aggregate information, for example, avg $200,000 {{grouping3 row}} contains the 3rd level grouping value, for example, type abc (30 records) {{grouping3 value}} contains the 3rd level grouping value (lightning only), for example, abc (30) {{grouping3 value only}} contains the 3rd level grouping value only (lightning only), for example, abc {{grouping3 aggregate row}} contains the 3rd level numeric aggregate information, for example, avg $300,000 {{data row}} main data values from the report {{alternating data row}} the alternating data row also contains the main data values but represents the odd numbered rows this row is not required but if included allows you to use an alternating style for the odd numbered rows {{grand total row}} the grand total row contains the textual grand total information, e g , grand totals (100 records) {{grand total aggregate row}} the grand total aggregate row contains the grand total numeric aggregate information, e g , avg $1,000,000 standard data variables standard data variable tokens are used to place data values into the report note that row type tokens are used to specify a type of table or row and will be removed entirely when unaric reports produces the final output data variables, on the other hand, are not removed but replaced with the data variable token description {{value}} the value token is a generic token that represents the data value each cell everywhere you need a data value, you would include this token as you can see in the examples, it's included in just about every row except for the column headers on the type 2 table type {{unformatted value}} the unformatted value token is similar to the value token expect that it is used to bring in the unformatted value {{field value field api name}} the field value token gives you more control on where to place your data within the template for example, if you wanted to have a formula column between two report columns to use a named value token, prefix it with field value and then add the api name for example, if the api name was account id, your token would be {{field value account id}} {{user name}} name of the running user {{report name}} report name {{report chart}} report chart advanced data variables advanced data variable tokens provides even more control of the data values the {{value}} is used to easily put in the standard content for grouping and total rows for example, for summary row, {{value}} could be replaced with the type abc (10 records) this works great, but it assumes you want the data formatted as "{{grouping label}} {{grouping value}} ({{grouping count}} records)" this is the salesforce and unaric reports default but what if you want to change it? that is where the advanced data variables come in with advanced data variables, unaric reports includes a variable for each dynamic data item you can use the table type 2 full (all variables) docx template above as a good starter template variable token description {{grouping label}} name of the field that the data is grouped by {{grouping value}} value of the field that the data is grouped by {{grouping count}} total number of records in the grouping {{grouping count label}} the word "record" (if 1 row in this grouping) or "records" (if 0 or more than 1 row in this grouping) {{grand total count}} grand total number of records {{grand total count label}} the word "record" (if 1 record) or "records" (if 0 or more than 1 record) metric header variables lightning metric header variable enable you include the metric header values you can add these tokens as either a table or as stand alone text in the document you will need to set up a token for each of the metric header's you wish to include you can add just the label or value for each or both variable token description {{metric label#}} this will be the label for the metric header such as 'total records' the # is the metric header index from left to right starting with 1 for example, {{metric label1}} , {{metric label2}} , etc {{metric value#}} this will be the value for the metric header such as '11' again the # is the metric header index from left to right starting with 1 for example, {{metric value1}} , {{metric value2}} , etc utility tokens utility tokens are special parameters used to control the visual output, row behaviour, and dynamic date values within your reports variable token description {{auto fit widths}} if using type 2, place this between {{header row}} and your column label and unaric reports will automatically adjust the width of each column to fit the data within it {{auto fit heights}} if using type 2, place this between {{header row}} and your column label and unaric reports will automatically adjust the height of each column to fit the data within it {{no hyperlink}} this token allows you to set remove hyperlinks to salesforce records add this token directly after your value token with no space in between for example, {{value}}{{no hyperlink}} {{auto fit}} you can include this token in the same cell directly after the report chart token in order to fit the row to the height of the chart image (example {{report chart}}{{auto fit}} ) doing so helps the chart fit better instead of displaying over the top of any data below it this feature will only work for a chart with a height of 540px or less {{delete row}} to delete a row after the data has been merged, add this token this can be helpful, for example, if you are creating a csv file and need to exclude the header row {{delete column}} to delete a column after the data has been merged, add this token this can be helpful if you are needing to remove a column that was only used for calculation purposes but does not need to be included in the final output {{dashes to blank}} this token allows you to set null ( ) salesforce values to blank add this token directly after your value token with no space in between for example, {{value}}{{dashes to blank}} {{date}} today's date value format is m/d/yyyy (example 10/3/2021) {{full date}} or {{today}} today's full date value format is mmmm dd, yyyy (example october 30, 2021) {{date time}} today's date time value format is m/d/yyyy h\ mm a (example 10/3/2021 1 07 am) {{previous week date}} last week's date value format is m/d/yyyy (example 10/3/2021) {{previous month date}} last month's date value format is m/d/yyyy (example 10/3/2021) {{previous month first day date}} first day of the previous month format is m/d/yyyy (example 1/1/2022) {{previous month last day date}} last day of the previous month format is m/d/yyyy (example 1/31/2022) custom format tokens this set of tokens further extend the control of the data values using the custom format tokens, you can display the data in any format you want \\\\@ allows formatting of dates \\\\+ or \\\\ allows you to add or subtract days to any date token \\\\# allows formatting of numbers and currencies variable token description \\\\@ allows formatting of dates \\\\+ or \\\\ allows you to add or subtract days to any date token \\\\# allows formatting of numbers and currencies {{date\\\\@mmmm d, yyyy}} or {{value\\\\@mmmm d, yyyy}} a date with a custom format like above would display with a full month name, the digit of the day number without a leading zero, and the year as a four digit number ex january 1, 2020 {{date\\\\+14}} or {{today\\\\ 7}} by using the above format, you can add or subtract any number of days from any standard date variable {{date\\\\ 30\\\\@mmmm d, yyy}} you can also combine both of the custom date formatters like above this way you could do 30 days ago in any format you like {{value\\\\##,##0 00}} the number value will display as a number with two decimals ex 3 14 {{value\\\\#$#,##0 00}} the number value will display as a currency value with two decimals ex $3 14 {{value\\\\##,##0 00%}} the number value will display as a percentage with two decimals ex 3 14% split currency tokens splitting currency fields breaks the currency type and the currency value into their own separate columns this enables the currency value to be treated as a number field in excel rather than a plain text field variable token description {{value currency}} and {{value amount}} for this to work you need to use a type2 template you can use one or both of these tokens if using both they need to be in separate columns that are next to each other in place of the value token typically used in that cell {{field value field api name currency}} and {{field value field api name amount}} if you are using field value you'll use these tokens, you can use one or both if using both they need to be in separate columns, in place of the field value token typically used in that cell