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

  • FILE save an Analytics table layout to an external table layout file (.layout)
  • TABLE save table layout metadata to an Analytics table (.fil)

TO file_name | table_name

The name of the output file, and the output location:

  • filename the name of the .layout file

    Specify the filename as a quoted string. For example: TO "Ap_Trans.layout".

    The .layout file extension is used by default, so specifying it is optional.

    By default, the file is saved to the folder containing the Analytics project.

    Use either an absolute or relative file path to save the file to a different, existing folder:

    • TO "C:\Ap_Trans.layout"
    • TO "Table Layouts\Ap_Trans.layout"

    Note

    Limit the table layout name to 64 alphanumeric characters, not including the .layout extension, to ensure that the name is not truncated when the table layout is imported back into Analytics.

    The name can include the underscore character ( _ ), but no other special characters, or any spaces. The name cannot start with a number.

  • table_namethe name of the Analytics table and .fil file

    Specify the table_name as a quoted string. For example: TO "Ap_Trans_layout_metadata.fil".

    The .fil file extension is used by default, so specifying it is optional.

    By default, the table data file (.fil) is saved to the folder containing the Analytics project.

    Use either an absolute or relative file path to save the data file to a different, existing folder:

    • TO "C:\Ap_Trans_layout_metadata.fil"
    • TO "Layout Metadata\Ap_Trans_layout_metadata.fil"

    Note

    Table names are limited to 64 alphanumeric characters, not including the .FIL extension. The name can include the underscore character ( _ ), but no other special characters, or any spaces. The name cannot start with a number.

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.