You are here: Commands > Define Column

Define Column

Use the Define Column command to add a column to a new View that has already been defined using the Define View command. For more information on the Define View command, see Define Report / View.

Define Column is particularly useful for adding columns to a new View because field modifiers can be specified to override default column attributes (including the column heading) for an existing field. The use of field modifiers is not available when building a View using the Define View command.

When using Define Column, columns are added from left to right in the View, so if multiple columns are to be added, issue the Define Column commands in order of precedence (from left to right).

This command can be issued only in command mode. For more information, see Issuing Commands.

Command Mode Syntax

Use the following command mode syntax to add columns to an existing View.

DEFINE COLUMN view_name field_name <AS "Alternate_Column_Title"> <WIDTH n> <PIC "format"> <SORT | SORT D> <KEY> <PAGE> <NODUPS> <NOZEROS> <NRED> <LINE n>¿

view_name specifies the View to which this column is to be added.
field_name is the field in the source table that is to be added to the View. To use a field from a related table, specify the field name as table_name.field_name.
AS "Alternate_Column_Title" specifies a column title that is different from source column title specified in the field name. By default, the source column name is used as the column title. You can add breaks to a column title by placing a semi-colon ";" at the breakpoints.
WIDTH n specifies the column width for View display. If not specified, Analyzer uses the default for this data type.
PIC "format" specifies the View column formatting (separators, decimals etc.) required for a source numeric field.
SORT | SORT D specifies whether the column is to be sorted in ascending or descending order for reporting purposes.
PAGE inserts a page break after the totals for the specified key field.
NODUPS causes repeated values in a column (field) to be displayed as blanks in a report.
NOZEROS causes zero values in a numeric column (field) to be displayed as blanks in a report.
NRED causes negative values in a numeric column (field) to be displayed in RED
LINE n is a multi-line indicator for a field. If not specified, the column defaults to a single line. The n value must be between 2 and 60.
KEY sets this column in the View as a Break Column for reporting purposes.

Analyzer has the following restrictions on break fields:

Break columns must be character fields.
If a Break Column is set in the View, it must be the leftmost column.
The last column in the view cannot be a break column.
If you have more than one break column, all of the columns to the left of any additional break column must also be break columns.

Examples

After opening a standard receivables table (AR), the following examples illustrate creating a new view called New_View and then populating this new view with desired columns:

Note: The six columns will be added to the new view in listed order from left to right. In addition, the Break Column(s) must always be specified as the left-most column(s) in the view.

DEFINE VIEW New_View OK

DEFINE COLUMN New_View No AS "Customer;Number" WIDTH 7 KEY

DEFINE COLUMN New_View Date AS "Invoice;Date" WIDTH 10

DEFINE COLUMN New_View Due AS "Due;Date" WIDTH 10

DEFINE COLUMN New_View Ref AS "Reference;Number" WIDTH 6

DEFINE COLUMN New_View Type AS "Transaction;Type" WIDTH 5

DEFINE COLUMN New_View Amount AS "Transaction;Amount" WIDTH 12 PIC "-9999999999.99" NRED

The Define Column command can also be used to define column triggers in the View. For information on column triggers see Specifying Column Triggers. To define column triggers using the Define Column command please contact Arbutus Technical Support.