You are here: Commands > Copy

Copy

The Copy command is only available in command mode and is used to create a copy of an existing table layout. If the table layout being copied resides in a shared folder, the resulting table layout will be written to the local project folder.

Use this command to duplicate an existing table layout while varying or limiting the fields defined in the new table layout. This is especially useful when working with relational data sources which contain a large number of fields. Creating a table layout containing only the fields required for the current process may improve subsequent performance.

Note: This command does not require the table layout being copied to be open.

Where applicable, the SERVER, FILE, ORDER, WHERE and SUBSYSTEM tags contained in the table layout to be copied can be specified in order to add this tag value or to override an existing tag value. The new tag value must follow the specified tag. Actual square brackets surrounding the tag can be included but will be ignored.

Parameters

The Copy command has the following command parameters:

Layout

This keyword is optional, but must be followed by the name of the existing table layout to be copied.

As

If included, it must be followed by a new table layout name. If not included, or the specified table layout name already exists, then a new unique name will be derived from the specified source table layout name (e.g. “table_layout2”).

Fields

If included, it must be followed by the list of fields to be included. If not included, the field list from the existing source table layout is used. The AS clause is also supported for renaming fields in the field list.

Note: Only fields defined in the source table layout can be referenced. For a description of supported field modifiers see Field Modifiers.

File

If included, it must be followed the filename (and path) to be linked to the table layout. If not included, the table layout remains linked to the original data file.

Subsystem

If included, it must be followed by a valid subsystem, which will add the subsystem to the copied table layout, or update the subsystem if one already exists. If not included, the existing subsystem (if any) from the source table layout is used.

Server

If included, it must be followed by the name of the server profile to use to connect to the server data source. If not included, the server profile information (if any) from the specified source table layout is used.

Order

If included, it must be followed by a valid SQL Order clause which will add the clause to the copied table layout, or update the clause if one already exists. If not included, the existing clause (if any) from the source table layout is used.

Where

If included, it must be followed by a valid SQL Where clause which will add the clause to the copied table layout, or update the clause if one already exists. If not included, the existing clause (if any) from the source table layout is used.

Anything included in the Copy command that is not understood will be treated as a field name.

Command Mode Syntax

COPY <LAYOUT> table-layout <AS new-table-layout> <FIELDS field-list> ,<FILE filename> <SUBSYSTEM subsystem> <SERVER server_profile_name> <ORDER SQL_order_clause> <WHERE SQL_where-clause>Ώ

• Table-Layout specifies the name of the existing table layout
• New-Table-Layout specifies the name of the new table layout to be created
• Field-List specifies the list of existing fields to include in the new table layout
• Filename specifies the path and filename to be linked tot the new table layout
• Subsystem specifies the database subsystem to be used to access the specified table (file)
• Server-Profile-Name specifies the name of an existing server profile used to connect to the underlying server data source. Normally this would be taken by default from the existing source table layout specified and therefore would not need to be explicitly specified.
• SQL_order_clause specifies the SQL order clause to be used to order the specified table (file)
• SQL_where_clause specifies the SQL where clause to be used to order the specified table (file)

Examples

When copying an existing table layout AR with the fields NO, DATE, and AMOUNT locally, the result in the Command Log will be:

@ COPY LAYOUT AR as 'NEW_AR' FIELDS No Date Amount

Layout AR copied to NEW_AR.

When copying an existing table layout AR with the fields NO, DATE, and AMOUNT to the server NT_SERVER, the result in the Command Log will be:

@ COPY LAYOUT AR as 'NEW_AR' FIELDS No Date Amount SERVER 'NT_Server'

Layout AR copied to NEW_AR.

When copying an existing table layout AR with the fields NO, DATE, and AMOUNT as well as an invalid field named JUNK locally, the result in the Command Log will be:

@ COPY LAYOUT AR as 'NEW_AR' FIELDS No Date Amount Junk

Field JUNK not found in layout AR.

Layout AR copied to NEW_AR.