[List.Table:]
Insert a list as a table.
Purpose
Insert a list as a table. For row and cell thresholds (warning, error, critical, fatal), see Using Variable Parameters
Macro Compatibility
The macro can be used in all input document types and in Report Studio.
Usage
Note: when using empty header values (in the values parameter), in Excel ouptut (where an actual 'Excel table' is created), blank headers are not allowed, and so (as Excel does) we use instead Column1, Column2, etc. NOTE: in Normal mode, you should use late evaluation if you are inputting a list or table variable into the values parameter.
Parameter | Type | Deprecation Message | Preferred Parameter | Presence | Purpose | Options | Default |
---|---|---|---|---|---|---|---|
List<List<String> | Mandatory | The data to convert into a table in the form: HEADER_ROW;DATA_ROW_1;DATA_ROW_2. Each row is in the form: Cell_1^Cell_2^Cell...^Cell_N. Limitations: 1) Cells may not currently contain semicolons or carats. 2) Each row should have the same number of cells. 3) Additional cells per row are ignored. 4) If too few rows are specified, a blank cell is inserted. 5) Infinity values are not permitted and will cause a macro error, unless you use format=AllStrings. | N/A | N/A | |||
List<String> | Deprecated | columnAlignments | The column alignments. If fewer alignments are made than the number of columns, the last given value is used for the remaining columns. If omitted, no change is made. Supported values: Left, Right and Center. Usage: columnAlignments=Left;Right;Center;...In Excel output files, columns may be automatically aligned based on their type (e.g. numbers are always right-justified), and all column headers are ALWAYS left-justified so their text is not obscured by filter drop-down arrows in the Excel UI. | N/A | N/A | ||
List<String> | Deprecated | columnAlignments | The column alignments. If fewer alignments are made than the number of columns, the last given value is used for the remaining columns. If omitted, no change is made. Supported values: Left, Right and Center. Usage: columnAlignments=Left;Right;Center;...In Excel output files, columns may be automatically aligned based on their type (e.g. numbers are always right-justified), and all column headers are ALWAYS left-justified so their text is not obscured by filter drop-down arrows in the Excel UI. | N/A | N/A | ||
AutoFitBehavior | Deprecated | autoFit | The Word autofit behaviour. If omitted, no change is made. |
|
Content | ||
AutoFitBehavior | Use instead of:
| Optional | The Word autofit behaviour. If omitted, no change is made. |
|
Content | ||
List<String> | Use instead of:
| Optional | The column alignments. If fewer alignments are made than the number of columns, the last given value is used for the remaining columns. If omitted, no change is made. Supported values: Left, Right and Center. Usage: columnAlignments=Left;Right;Center;...In Excel output files, columns may be automatically aligned based on their type (e.g. numbers are always right-justified), and all column headers are ALWAYS left-justified so their text is not obscured by filter drop-down arrows in the Excel UI. | N/A | N/A | ||
List<String> | Optional | The column names to show. If the columns parameter is not specified, the Macro's default will be used. | N/A | N/A | |||
String | Optional | Add a comment to make your document template more readable. The comment is discarded in the output document. | N/A | N/A | |||
Boolean | Optional | Whether to automatically convert any of the values that begin with http:// or https:// to a clickable web link. |
|
false | |||
Color | Optional | The critical cell background color to use. If omitted, no change is made. Affects a cell or row based on the ThresholdAffects parameter. |
|
Color [A=255, R=192, G=0, B=0] | |||
Color | Optional | The critical cell text color to use. If omitted, no change is made. Affects a cell or row based on the ThresholdAffects parameter. |
|
N/A | |||
String | Optional | The date/time format to use. Use the format specified here: https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings. When the format parameter is set to AllStrings, this is ignored unless you use NumbersAsStrings. Note however that this parameter only has an effect if all the values in the column are the same type. | N/A | yyyy-MM-dd | |||
Boolean | Optional | Whether to de-camel-case the header row (i.e. convert 'MyHeaderText' to 'My Header Text'. |
|
false | |||
String | Optional | If present, and the table has no rows, the specified text will be inserted in place of the table. | N/A | N/A | |||
Color | Optional | The error cell background color to use. If omitted, no change is made. Affects a cell or row based on the ThresholdAffects parameter. |
|
Color [A=255, R=240, G=128, B=0] | |||
Color | Optional | The error cell text color to use. If omitted, no change is made. Affects a cell or row based on the ThresholdAffects parameter. |
|
N/A | |||
Boolean | Optional | Should NCalc expression evaluation throw error on Overflow |
|
true | |||
String | Optional | The text to display should the macro fail to execute. Note that a poorly-specified macro (e.g. omitting mandatory parameters) will still result in an error message. | N/A | N/A | |||
Color | Optional | The fatal cell background color to use. If omitted, no change is made. Affects a cell or row based on the ThresholdAffects parameter. |
|
Color [A=255, R=150, G=0, B=0] | |||
Color | Optional | The fatal cell text color to use. If omitted, no change is made. Affects a cell or row based on the ThresholdAffects parameter. |
|
N/A | |||
Double | Optional | Override the table style's font size. This is achieved by setting the font size for each table cell. |
|
N/A | |||
CellFormat | Optional | The cell format to use. Options are: 'AllStrings', 'Auto' or 'NumbersAsStrings'. Auto automatically sets the format for the whole column, or it can be forced to a string with AllStrings. To preserve date / time formatting (with dateTimeFormat) but treat only number columns as strings, use NumbersAsStrings. |
|
Auto | |||
List<String> | Optional | This parameter adds an additional list of strings as the first row. | N/A | N/A | |||
Boolean | Optional | If true, the table will not be written to the report. |
|
false | |||
TableHorizontalAlignment | Optional | The horizontal alignment of the table on the page (does not affect Excel output). |
|
Left | |||
String | Optional | The condition that must be true in order for the macro to be executed/evaluated. Must either evaluate to true or false, for example: "3+5=8" or "contains('abcd', 'z'). | N/A | true | |||
String | Optional | The condition on which each row is included. Fields should be referred to based on the column name in curly braces, for example: includeCondition ='{CreatedOn}'>'{StartOfLastMonth}'. | N/A | N/A | |||
Color | Optional | The info cell background color to use. If omitted, no change is made. Affects a cell or row based on the ThresholdAffects parameter. |
|
Color [A=255, R=0, G=213, B=213] | |||
Color | Optional | The info cell text color to use. If omitted, no change is made. Affects a cell or row based on the ThresholdAffects parameter. |
|
N/A | |||
MacroMode | Optional | The mode in which variables are stored. In the legacy mode (default for Schedules), the variable created is a string and formatted. In the normal mode (default for Report Studio), the output variable is stored as a strongly-typed object, e.g. an Int32 or a List |
|
Legacy | |||
Color | Optional | The cell color to use when no issue exists. Affects a cell or row based on the ThresholdAffects parameter. |
|
N/A | |||
Color | Optional | The cell text color to use when no issue exists. Affects a cell or row based on the ThresholdAffects parameter. |
|
N/A | |||
ObfuscationType | Optional | Obfuscation type. Use obfuscation to write reports where sensitive data is hidden. When used, ReportMagic guarantees that the same input string will map to the same output string for the whole of the report (but the next time the report runs, it will most likely map to a different value). If you use obfuscation, the property in your macro will not show up and instead, you will see a fake item of the obfuscation type chosen. |
|
None | |||
String | Optional | If present, sorts alphanumerically by this column. | N/A | N/A | |||
String | Optional | If present, sorts reverse alphanumerically by this column. | N/A | N/A | |||
Double | Optional | The percentage of the available page that the table should occupy. |
|
N/A | |||
Boolean | Optional | Whether to repeat the header row at the beginning of each page. |
|
true | |||
String | Optional | Use Word's built in Table Styles (such as Grid Table 2 - Accent 1), or make your own in the Report Template. Built-in styles can be used in any document. Note that any custom styles you create, or customisations to the standard styles required that the styles exist in the input template XML (because they are not saved in Word documents by default). This can be achieved by assigning the style to a table, then delete the table and save the document. | N/A | Table Grid | |||
String | Optional | The table name (e.g. for XLSX output) | N/A | Table | |||
Int32 | Use instead of:
| Optional | Only display up to this number of rows. |
|
N/A | ||
ThresholdAffects | Optional | What the threshold affects. |
|
Cell | |||
String | Optional | The threshold column. | N/A | N/A | |||
Int32 | Deprecated | take | Only display up to this number of rows. |
|
N/A | ||
String | Optional | If specified, adds a warning message for this macro. This is processed as an NCalc, and the warning message will ALWAYS be present and will be the value of the evaluated NCalc expression. | N/A | N/A | |||
Color | Optional | The warning cell background color to use. If omitted, no change is made. Affects a cell or row based on the ThresholdAffects parameter. |
|
Color [A=255, R=240, G=192, B=0] | |||
Color | Optional | The warning cell text color to use. If omitted, no change is made. Affects a cell or row based on the ThresholdAffects parameter. |
|
N/A | |||
String | Optional | The worksheet to save the result in the output Excel document (if so configured). Excel does not allow blank names, names above 31 characters, and the following characters: :, /, \, ?, *, [, ] | N/A | Table | |||
Boolean | Optional | Whether to output the result in the output Excel document (if so configured). |
|
true | |||
XlsxTableStyle | Optional | The XLSX table style to use in any XLSX output document. |
|
TableStyleMedium13 |
Examples (10)
Example 1:
[Calculate: value=`list(list('Month', 'London', 'Manchester', 'Cardiff', 'Newcastle'), list('October', 1, 2, 3, 4), list('September', 5, 6, 7, 8))`, =>Values][List.Table: values={=Values}]
Example 2:
[List.Table: values=Month^London^Manchester^Cardiff^Newcastle;October^1^2^3^4^;September^5^6^7^8]
Example 3:
Right-justify the first 2 columns, and the rest left:
[List.Table: values=Month^London^Manchester^Cardiff^Newcastle;October^1^2^3^4^;September^5^6^7^8, columnAlignments=Right;Right;Left]
Example 4:
Order by the 'Month' column descending (use 'orderBy' for ascending order):
[List.Table: values=Month^London^Manchester^Cardiff^Newcastle;October^1^2^3^4^;September^5^6^7^8, orderByDescending=Month]
Example 5:
Only include rows where the 'CPU%' column values are more than 20. To be treated as a number, 20 must not be inside any single quotes. Note the CPU% column's value is referenced as {CPU%}:
[List.Table: values=DeviceType^CPU%;Router1^5;Router2^2;Router3^34;Firewall3^99, orderByDescending=DeviceType, includeCondition="{CPU%} > 20"]
Example 6:
Only include rows where the 'DeviceType' column values are 'Router':
[List.Table: values=DeviceType^CPU%;Router1^5;Router2^2;Router3^34;Firewall3^99, orderByDescending=CPU%, includeCondition="contains('{DeviceType}', 'Router')"]
Example 7:
Various 'table' variables are used as input to the List.Table macro:
[=:`list(list(1, 2),list(3, 4))`,=>A][List.Table: values={=A}]
Example 8:
Various 'table' variables are used as input to the List.Table macro:
[=:`list(list(1, 2), list(0, 4), list(3, 4), list(7, 2), list(912345, 234567), list(9, 4))`,=>B][List.Table: values={=B}]
Example 9:
Various 'table' variables are used as input to the List.Table macro:
[=:`list(list('a', 'd'), list('z', 's'), list('f', 'b'), list('b', 'q'), list('j', 'k'), list('p', 'w'))`,=>C][List.Table: values={=C}]
Example 10:
Various 'table' variables are used as input to the List.Table macro:
[=:`list(list('a', 'd'), list('z', 's'), list('f', 'b'), list(7, 2), list(912345, 234567), list(9, 4))`,=>D][List.Table: values={=D}]