DDEditor - main field table

The most commonly used field properties are displayed in the main field table. To view or amend other properties, right-click on the field and select the Expand field details option. The right-mouse menu is also used to delete, insert and move fields.

The field number column at the left of the table can be used to select a line or lines, SHIFT-CLICK and CTRL-CLICK having their usual functionality. Selected lines can be pasted to a new position.

Key

A tick in this column indicates that the field is a key field. Otherwise it is a data field.

All the key fields must appear at the beginning of the index.

See Key fields and data fields for information on key structure and advice on key field selection.

The number and total length of the key fields in bytes are displayed above the table. The key length must fall within the range 1-195 bytes.

When a new data dictionary is created, the first field to be entered is automatically made into a key field. Subsequent fields are created as data fields by default. Click in the Key column to change a field’s status from key to data to vice versa.

If a new field is inserted between existing fields, it is created as a data field if its position allows this, otherwise key.

Note that since all key fields must be placed contiguously at the beginning of the index, changing a field’s key/data status will affect other fields also, unless the field being changed is the last key field or the first data field. Any such changes are performed automatically.

Subscripted fields (those where Dims > 1) cannot be key fields. Therefore a field cannot be changed from data to key if any earlier field is subscripted.

If the key of an existing file containing data is changed, the file must be reformatted and all existing programs using the file must be recompiled. Additionally, it is likely that existing programs will have to be modified to use the new key structure correctly.

RELATED TOPICS

Changing an existing data dictionary

Name

The field name, also known as its identifier, is the name used to refer to the field in a program. It will usually give some indication as to the nature of the data the field will contain.

Standard Sculptor identifier naming rulesapply. Note also that the name cannot be that of a secondary index.

Every field name within a particular data dictionary must be unique. However, the same name may be used in two or more different data dictionaries without conflict arising in a program that uses them both. This is because all files declared in a program are assigned a unique file_id, which can be used as a prefix to the field name to construct a unique identifier. See ![o]file.

The name length is not restricted to the viewable width of the table column. Use the HOME and END keys to move the cursor to the beginning or end of the name text and to scroll it accordingly within the table cell.

Heading

A default heading for the field, which is used when the field is displayed on the screen in a textbox or printed in a report. If no heading is specified, the default heading is the field’s name.

The heading length is not restricted to the viewable width of the table column. Use the HOME and END keys to move the cursor to the beginning or end of the heading text and to scroll it accordingly within the table cell.

Type and size

The type and size of a field are closely related.

The type must be applicable to the nature of the data to be stored in the field, e.g. alphanumeric, integer number, floating point number. The size is the size of the field in bytes, e.g. 20 = 20 bytes. The size assigned to a field must be a valid size for the field type.

In the data dictionary editor types are specified by description (e.g. Alpha, Integer). A valid type and size must be specified for every field. When a new field is created the default type and size (set by the Configure menu option) are assigned to it. Types are selected from a listbox. When a type has been selected, the default size is displayed automatically if the current value of Size is blank, or isn’t valid for the type. The valid types are:

Description

Type

Size

Alpha. An alphanumeric field may contain any printable character.

a

1-255

Binary. A binary field may contain any character. 1

b

1-255

Integer (signed). The ranges are as follows:

i2

-32767 to 32767

i4

-2,147,483,647 to 2,147,483,647

i8

-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 2

i

2, 4, 8

Number. The full size specification is 4.d or 8.d where d is an integer between 0 and 4, specifying the number of decimal places to be stored. Currently 0 is the only valid value for d.

n

4.0, 8.0

Real. A floating-point field stored internally in IEEE floating point format. The range is:

r8

10^–37 - 10^38; up to 15 significant digits; maximum absolute value approximately 1.79e+308

r

8

Unsigned integer. The range is 0-255.

u

1

1

Binary data type is supported since Sculptor version 6.1.0

2

i8 data type is supported since Sculptor version 6.2.0

In the table above, the Type column indicates the single letter that is used in Sculptor programs to assign the type to a temporary field. This letter (e.g. a=alphanumeric) forms the first part of the type and size specification. The size forms the second. The two parts are concatenated to form the full type and size specification: a20. This form is also used in this reference guide.

Note that a larger range of types and sizes is available for temporary variables.

Dims

If the field is to be dimensioned (subscripted), this property specifies the number of elements in the array. The default value is 1, indicating an unsubscripted field. Key fields may not be dimensioned. Note that data dictionary fields may be subscripted in one dimension only, whereas temporary fields may be subscripted in up to four.

A secondary index may reference any element of an array field. If a field’s dimension is reduced such that a referenced element would no longer exist, the user is warned. If the amendment is confirmed, the referenced element of the secondary index field is changed to 1.

Open the Field Details screen to check which is the highest element currently referenced by a secondary index. This can be done by pressing the Field Details button, or by selecting the Expand field details right-mouse menu option.

Logical type

Certain data types may be allocated a logical type, which affects the interpretation of the data they contain. Currently the only logical types available are:

Desc

Type

Meaning

Money

my

Treat as money. A money field has a main currency unit equal to 100 of the lower unit, and is stored internally as an integer in the lower currency unit. This helps avoid rounding errors. When performing multiplication or division on such fields, remember that the values are stored in the lower currency unit.

This type is compulsory for Number (n) type fields in data dictionaries.

Date

dn (day number)

A date type field, stored as a day number starting from 01/01/0001. Dividing a date by 7 and taking the remainder (using the % operator) gives the day of the week (Sunday = 0).

This type is optional for i4 fieldsin data dictionaries.

The Type indicates the characters used to assign the type to a temporary field. A much wider range of logical types is available for use with temporary fields, mostly to store date and time values. In order to use these types with data dictionary fields, assign the type at run time, using the syntax:

field_id->logical_type = flag

Logical type flags are defined in the standard include file sculptor.h with the prefix LT_.

Format

A format determines the precise way in which a field is displayed, printed and input. If no format is provided, a standard default for the field type and size is applied.

See Numeric field formats for full details of format characters that can be used with numeric fields.

A date format template may be assigned to a day number field. To create a day number field, assign the Logical type “Date” to a numeric field of type i4. The characters d, m and y are used to represent the day, month and year respectively. The year may be two or four digits, or may be missing altogether. The default separator character is a slash (( “/” ) but most other punctuation characters are valid alternatives. Note that time fields cannot be defined in a data dictionary.

In alphanumeric fields, data is normally output precisely as input, the number of characters equalling the field size. See Alphanumeric field formats for the format characters available for this field type.

Many format-type operations, including all those relating to assignment, are performed by field flags. Flags cannot be stored in a data dictionary, but can be assigned to a field at runtime using the syntax:

field_id->flags = text_expression

Note the special field formats u+ and l+, which are for use with data dictionary fields only. The combine the effects of a format and flag, meaning the field is converted to upper or lower case both on input and assignment.

Validation

A list of individual values, ranges of values, or a combination of both, limiting the acceptable inputs into the field. The items in the list are separated by commas, while hyphens are used to indicate a range. See Field validation list.


RELATED TOPICS

Data dictionary editor

Field Details window