Physical fields
In an Analytics table layout, a field that corresponds to actual physical data in a data source is called a physical field.
A physical field, also called a field definition, structures raw field data by specifying metadata information, including:
- the name of the field
- the start position of the field in the record
- the length of the field
- the data type of the field, which determines how Analytics reads and processes the data stored in the field
Additional information may also need to be specified based on the data type, and the settings you want to provide to override default values. For example, the formatting to apply to numeric fields, or the column title used in views and reports, can either be left blank and a default value is assigned, or you can specify the value to use.
Example of a physical field definition
The example below shows the definition for the Invoice_Amount field in the Table Layout dialog box. In the data preview area, the actual physical data included in the field is highlighted green.
Metadata element | Description | Value |
---|---|---|
Name | physical field name | Invoice_Amount |
Type | data type | Numeric |
Start | field start position | byte position 29 |
Len. | field length | 12 bytes |
Dec. | decimal places | 2 |
Valid Data Types | Clickable list of suggested data types |
Numeric includes preview of first value in the field |
Format | numeric format |
(9,999,999.99)
|
Width | field display width in views and reports | 12 characters |
Alternate Column Title | field display name in views and reports | Invoice Amount (two lines) |
Define a physical field
You need to define a physical field for each field in a data source that you want to add to an Analytics table layout.
In most cases, the required physical fields are defined for you when you define and import data using the Data Definition Wizard or the Data Access window. However, you can define additional fields manually or you can choose to define all fields in a table layout manually.
Specify the start position and length of the field
- Select Edit > Table Layout.
- In the Edit Fields/Expressions tab, click Add a New Data Field .
- Do one of the following to specify the field start position and length:
- Click and drag In the data preview area, click and drag in any of the data rows in the grid to highlight the field.
- Manually specify In the Start and Len text
boxes, manually specify
the field start position and length in bytes.
If you manually specify the Start and Len values, follow these guidelines:
non-Unicode Analytics 1 byte = 1 character Unicode Analytics, extended ASCII (ANSI) data 1 byte = 1 character Unicode Analytics, Unicode data 2 bytes = 1 character For Unicode data:
- Start typically you should specify an odd-numbered starting byte position. Specifying an even-numbered starting position can cause characters to display incorrectly.
- Len specify an even number of bytes only. Specifying an odd number of bytes can cause characters to display incorrectly.
Specify field metadata
- Enter the name for the field in the Name text
box.
Note
Field names are limited to 256 upper and lowercase alphanumeric characters. The name can include the underscore character ( _ ), but no other special characters, or any spaces. The name cannot start with a number.
Analytics has a number of reserved keywords that cannot be used as field names. For a complete list, see Reserved keywords.
- Select or confirm the appropriate data type in the Type drop-down
list.
The type you specify must match the data type in the source data, or must be appropriate for how you are using the data. For example, a field may be numeric data in the data source but you might want to define the field in Analytics as character data.
Under Valid Data Types, a clickable list displays the data types that match the physical data you have specified. The most likely matches are listed first, with common types being listed before system or application-specific types.
- (Optional) Specify the display width for the field in
characters in the Width text box.
The Width value is used as the column size when displaying the field in Analytics views and reports.
- (Optional) Specify the display name in the Alternate
Column Title text box.
The display name is used as the column heading, instead of the field name, when displaying the field in Analytics views and reports. If a value is not specified, the field name is used.
- (Optional) If you want to limit the records evaluated by the computed field,
enter a condition in the If text box, or
click If to create an IF statement using
the Expression Builder.
Records excluded by the IF statement are not evaluated by the computed field. For example, the IF statement Invoice_Amount >= 1000 prevents records with invoice amounts less than $1000 from being evaluated.
For excluded records, the computed field values are blank, 0.00, or False (F), depending on the data category of the computed field.
- Depending on the data type you select, you may need to
specify values for the following settings:
Setting Description Dec Specifies the number of decimal places. This option is enabled only for numeric fields. Format Controls the display format of numeric fields in views and reports. It also specifies the input format of datetime fields in source data.
The drop-down list is disabled when data types other than numeric or datetime are selected. You can select the format from the drop-down list, type in the format manually, or edit a format from the list after you have selected it.
If the Format drop-down list is blank, the default display format specified in the Options dialog box applies to the data in this field. The format you specify here overrides the default format.
Suppress Totals Prevents the values in this field from being totaled.
Analytics automatically totals numeric fields in reports. Some numeric fields contain information that should not be totaled, such as unit prices or account numbers. This option is enabled only for Numeric data types.
Static Alters the default behavior Analytics uses when evaluating an IF statement associated with the field. (For more information about the optional IF statement, see Finalize the field definition.)
Static deselected (default) if the IF statement evaluates to False, the field is assigned an empty value – blank, zero (0), or False (F), depending on the data category of the field.
Static selected if the IF statement evaluates to False, Analytics repeats the last valid value in the field rather than using an empty value. The last valid value is repeated in each row until the IF statement evaluates to True and a new valid value is used.
Datetime Specifies that a numeric field should be interpreted as a datetime field.
If the Datetime checkbox is selected, you must also specify the datetime format to use in the Format drop-down list.
Control Total Specifies that the field is a control total field.
A control total is the sum of values in a numeric field, which can be used to check data integrity. When you extract or sort data to a new table, Analytics includes the input and output totals of a control total field in the table history. Input refers to the original table. Output refers to the new table. If the two totals match, no data was lost in the extract or sort operation.
You can also compare the control totals computed by Analytics with those supplied by a data provider to determine whether you received all the data.
If you specify control totals for more than one field, the table history reports on only the numeric field with the leftmost starting position.
Default Filter Filters the records in the default view based on the value of this field each time the Analytics table is opened.
Only records that evaluate to true are displayed, and the filter is applied automatically. This option is enabled only for the Logical data type, and only one default filter can be specified for each table layout.
Finalize the field definition
- (Optional) If you want to limit the values included in the field,
enter a condition in the If text box, or
click If to create an IF statement using
the Expression Builder.
- included in the field values that satisfy the IF statement
- excluded from the field values that do not satisfy the IF statement
For example, the IF statement Invoice_Amount >= 1000 includes invoice amounts of $1000 or greater, and excludes invoice amounts less than $1000.
Excluded values are not displayed in the field, or included in command processing. Depending on the data category of the field, excluded values appear as blank, zero (0), or False (F). You can undo the exclusion at any point by deleting the IF statement.
- (Optional) Deselect Add created field to current view if you do not want the newly defined field to be automatically added to the open table view.
If you leave the option selected, the new field is added to the table view. The field is positioned as the last column in view, or to the left of any selected column in the view.
You can manually add a field to a view at any time. For more information, see Add columns to a view.
- (Optional) If you want to add a note to accompany the field definition, click Edit Field Note , enter the note text, and click Close .
- Click Accept Entry .
Analytics adds the field definition to the table layout.
- Click Close to exit the Table Layout dialog box.
The associated column is added to the table view if you left Add created field to current view selected.
Defining datetime fields
Depending on the data source you are working with, datetime information (dates, datetimes, or times) may be stored as character data or numeric data. When you manually define a field that contains datetime information, Analytics treats it as character data by default. To ensure Analytics reads datetime information correctly, you need to select Datetime as the data type, and specify the datetime source format in the Format drop-down list.
Datetime source format
The datetime source format identifies the characters or digits in the source data that represent year, month, day, hour, minutes, and seconds, and any characters used to separate these parts of datetime data.
To match the way datetimes are stored in the source data, you can:
- select an existing datetime format
- specify your own datetime format
- select an existing format and modify it
For example, if December 31, 2014 is stored in the data source as 14-31-12, enter YY-DD-MM as the datetime format so that Analytics can interpret the date values correctly.
For more information, see Formats of date and time source data.
Datetime display format
The datetime source format you select or specify does not affect how datetime values are displayed in Analytics views or formatted in reports. The datetime display format depends on the Date Display Format and Time Display Format settings specified in the Date and Time tab in the Options dialog box.
For more information, see Date and Time tab (Options dialog box).
Defining overlapping fields
In most cases, when you define the physical fields in a record, each byte position in the record is assigned to only one field. At its most basic, defining a table is a matter of defining the start position and length of each field in the record, and one field starts after the previous field ends.
In some cases, however, you may need to define fields that overlap with each other, and some byte positions are used in more that one field. This situation might occur if the structure of the source data is non-standard, or if you want to work with the data in Analytics in a certain way.
For example, you could define the first six positions in a data source as a datetime field with the format DDMMYY, and then separately define a two-byte numeric field in position 3 and 4 for the month. This approach would allow you to access the entire date in one field for aging purposes, and have the month as a separate value in another field for generating monthly totals.