SAVE LAYOUT command
Saves an Analytics table layout to an external table layout file (.layout), or saves table layout metadata to an Analytics table.
Note
Prior to version 11 of Analytics, external table layout files used an .fmt file extension. You can still save a table layout file with an .fmt extension by manually specifying the extension.
Syntax
SAVE LAYOUT {FILE|TABLE} TO {file_name|table_name}
Parameters
Name | Description |
---|---|
FILE | TABLE |
|
TO file_name | table_name |
The name of the output file, and the output location:
|
Examples
Saving a table layout to an external table layout file (.layout)
The following examples save the table layout used by the open table to an external table layout file called Ap_Trans.layout:
Here, the table layout file is saved in the Analytics project folder:
SAVE LAYOUT FILE TO Ap_Trans.layout
Here, the table layout file is saved in the specified folder:
SAVE LAYOUT FILE TO "C:\ACL_DATA\AP Audit 2013\Ap_Trans.layout"
Saving a copy of table layout metadata to a new Analytics table
The following examples save a copy of the metadata in the table layout used by the open table to a new Analytics table called Ap_Trans_layout_metadata.
Here, the new Analytics table is saved in the Analytics project folder:
SAVE LAYOUT TABLE TO Ap_Trans_layout_metadata
Here, the new Analytics table is saved in the specified folder:
SAVE LAYOUT TABLE TO "C:\ACL_DATA\AP Audit 2013\Ap_Trans_layout_metadata"
Remarks
SAVE LAYOUT file vs table
The SAVE LAYOUT command is used for two different purposes:
- FILE saves the table layout of the open Analytics table to an external table layout file with a .layout extension
- TABLE extracts the metadata from the table layout of the open Analytics table and saves it to a new Analytics table
SAVE LAYOUT FILE
How it works
SAVE LAYOUT FILE saves the table layout of the open Analytics table to an external table layout file with a .layout extension.
A table layout contains metadata that provides a structured interpretation of the raw data in an associated source data file. A table layout does not contain any source data itself.
When to use SAVE LAYOUT FILE
Saving a table layout as a .layout file makes the table layout and its metadata portable and reusable.
The .layout file can be imported into any Analytics project and associated with a matching source data file. The data elements in the source data file must match the field definitions specified by the table layout metadata.
For example, you could save the table layout of a transactions file from March, and associate it with a source data file containing transactions from April, assuming the structure of the data in the March and April source data files is identical. Used in this manner, .layout files can save you the labor of creating a new table layout from scratch.
For more information about the structure of Analytics tables, see the Structuring data with table layouts.
SAVE LAYOUT TABLE
How it works
SAVE LAYOUT TABLE extracts the metadata from the table layout of the open Analytics table and saves it to a new Analytics table.
The new table is not the table layout itself, but rather a regular Analytics table that contains a summary of the table layout metadata for the original table. Having access to this summary in an Analytics script can allow you to make decisions in the script based on the information.
For each field in the original table, the following pieces of table layout metadata are extracted into the new table.
Note
The field names in the new table are always generated in English regardless of which localized version of Analytics you are using.
Field name in new table | Table layout metadata |
---|---|
field_name | The name of the field |
data_type | The data type of the field |
category | The data category of the field |
start_position | The start position of the field |
field_length | The length of the field |
decimals | The number of decimal places in the field (numeric fields only) |
format | The format of the field (datetime and numeric fields only) |
alternate_title | The alternate column title of the field |
column_width | The width of the column in the view |
Additional details
Computed fields | Computed fields are included in the extracted metadata, but the expression used by the computed field, and any conditions, are not recorded. Start position, field length, and decimal places are also not recorded for computed fields. |
---|---|
Related fields | Related fields are not included because they are not part of the table layout. |
Field-level filters Field notes |
Field-level filters and field notes are not included. |
Alternate column title Column width |
The values recorded for alternate column title and column width are the ones specified in the table layout, not the view-level values that can be specified for columns. |