Fields - flags


field_id, [”heading”], type & size [[dim1 [, dim2 [, dim3 [, dim4]]]]] \
[/logical] [,”format” [, flags [, “validation”]]]

Flag characters define more general formatting operations than formats, and are more frequently used in conjunction with alphanumeric fields.

Flags are single alphanumeric characters, which may be combined into any order to form a string. The flag string is not enclosed in quotes.

If no flags are to be specified, but a validation list is required, two consecutive commas should be entered to mark the missing part of the specification. If neither flags nor validation is required, the field specification may end at format.

The following flags may be used singly or in combination to convert the input and/or output as shown.

a

Since Sculptor version 6.2.0 applied to an array field makes that field eligible for automatic redimension, which means than in certain cases the dimension sizes of the array will be automatically changed to the assigned value dimension size.

b

Treat the field as binary when used with get #, put # and put. This, a flagged b field, is distinct from a type b field, which is always treated as binary.

c

Print the text centred within its print column when using the print[h] command.

d

For use with alphanumeric fields only. The field is to be treated as a date (day number) field when a numeric value is assigned to it. The format used is the field format if specified; otherwise the default format for dates.

e

Suppress echo of input characters.

l

Fold entire field to lower case on assignment. The field format is used to force folding on input.

n

For use with alphanumeric fields only. When a numeric value is assigned to this field, the value is formatted to the field format if specified; otherwise the appropriate default numeric format. The field is aligned to the right in tables and in the print[h] command (alphanumeric fields are otherwise aligned to the left).

p

For use with alphanumeric and binary array fields only. This flag creates a long text/binary field, with all characters in the array stored as a single string. This enables the storage of up to 60000 characters as a single field.

r

Remove trailing spaces when the field is used in get #, put # and put commands. Alphanumeric fields only. Fields with this flag are stored as read by the get # command and written as stored by the put # and put commands, preserving the field length, rather than padding with spaces.

s

Remove leading spaces when printing. 1

t

Remove trailing spaces when printing. 1

U

Only relevant to main index key fields of type i2, i4 and i8. Sort as binary (positive values first) when creating an SQL table. See ODBC; ODBC sort order.

u

Fold entire field to upper case on assignment. The field format is used to force folding on input. 1

v

For use with text fields only. Store the field as variable length. 1

If a string constant is assigned to the field, or a value input into a textbox linked to the field, and the length of the data is less than the field length, the value is stored null terminated.

However, if the value is assigned from a field that doesn’t have this flag, any trailing spaces are copied. To avoid this, use the form:

!temp VarField,,a100,,v
!temp RegularField,,a100
VarField = RegularField / ""
1(1,2,3,4)

These flags are applied when the <SCFIELD> tag is used to place a field’s value in a web page, regardless of the field’s type. See Creating web pages with Sculptor; Special tags for HTML files.


Assigning or retrieving flags at runtime

Flags may be assigned in a program by the command:

field_id->flags = text_expression

Additionally, in a !report section, the print[h] command may be assigned additional flags to be used in that specific print statement, as in the following example:

print pr.field: :“st”

Any original flags still apply, unless the empty string “” is specified.

When a flag string is assigned at run time it must be enclosed in quotes, since an expression is required.

The form field_id->flags can also be used to retrieve field flags.


EXAMPLE

  1. Simple flags

    ut

    Force upper case on assignment, and remove trailing spaces when printing. Input to the field is not affected.


  2. Format and flag combinations

    "0000",n

    If the field is assigned a numeric value, use this format.

    "dd/mm/yy",d

    Treat as a date field on numerical assignment, using format template shown.


RELATED TOPICS

Data fields