UNIBASE ATTRIBUTE (FIELD) TYPES

NAME

type – UNIBASE attribute (field) types

DESCRIPTION

Field types in UNIBASE are single upper case letters. The following is a list of the field types and their meaning.

Additional details is extra information needed for the field type to be fully defined.

Each description is followed by one or more examples.

CODE TITLE DESCRIPTION
$ MONEY DESCRIPTION

Currently this is the same as N2. Number with 2 decimal places.

SYNTAX

$

EXAMPLE

price, 10 $
A ACCUMULATOR DESCRIPTION

An expression field which has the value of the expression added to the contents of the accumulator. Accumulators are cleared at subtotals unless R is used.

SYNTAX

     A{R}{<decimal places>}<expression>
     R - Do not reset the accumulator at subtotals
     

EXAMPLE

     balance, 10 A2 [amount]
     counter, 5 AR0 1
     
B BOOLEAN DESCRIPTION

A single character field that can be any of a list of upper case or digit characters.

SYNTAX

B<allowed characters>

EXAMPLE

sex, 1 BMF
C COUNTER DESCRIPTION

A counter. These are zero filled fields that can only be incremented, decremented or set. This type of field should be used in place of N (number) when the field is not really a number, but it should be all digits.

SYNTAX

C

EXAMPLE

line no, 3 C
D DATE DESCRIPTION

A date is entered as DD.MM.YY and stored as YYMMDD for sorting where DD is day of month, MM is month of year, and YY is year. Note that the field width must always be 6.

Dates can also have a century option in which case the date is entered as DD.MM.CCYY and stored as CCYYMMDD. In this case the field width must always be 8.

SYNTAX

D{C}

EXAMPLE

     date entered, 6 D
     date, 8 DC
     
E EXPRESSION DESCRIPTION

An expression consists of fields, numbers, strings and dates combined with the usual operators to form calculations. C,D,F, & Z modifiers (see ‘N’ numbers) may be used in conjunction with ‘E’.

Expressions may be arrays. In this case the index into the array may be used in the expression. It is represented symbolically by the character ‘#’ and may be used anywhere in the expression.

Modifiers – C,D,F, or Z – see numbers

SYNTAX

E{<modifier>}{<decimal places>}<expression>

EXAMPLE

        extension, 10 E2 [price] * [qty]
        discount, 5 EZ2 [customer.discount] * [extension] / 100
        sales, 10*7 E2 ([day] = "#") * [sales]
        
F FOREIGN KEY DESCRIPTION
The value in a foreign key field must exist in another table called the foreign key table. The foreign key field should be a unique index on the foreign key table.
In the first example there is only a foreign key file for reference.
In the second example the file state.txt (indicated by ‘F’) has a list of possible values that can be selected. This would normally be maintained in conjunction with the maintenance of the foreign key file.
In the third example the command ‘ubreport arealist’ (indicated by ‘C’) is used to generate the selection list as required. See ubitem (1) and item (4) for more detail on how this operation works.
In the fourth example the command ubmulti -s salesid is run (indicated by ‘X’), replacing the current screen temporarily, and the output from the command is placed in the field.
In the case of this ubmulti command the XX option would be used to echo a suitable value.
In the fifth example a field from the foreign key table is displayed instead of the foreign key field when a partial match is made.SYNTAX
F<foreign key table>{<browser box size (lines)>}{<item selection command>}

EXAMPLE

Optional item selection command
F List file
C List command
X Other command
[ ] Field to display

currency, 3 Fcurrency

state, 3 Fstate F stat.txt

areacode, 2 Farea C ubreport arealist

sales id, 8 Fsales X ubmulti -s salesid

customer, 6 Fcustomer [cust name]

customer, 6 Fcustomer 5 [cust name]

G GRAPHIC EXPRESSION DESCRIPTION
The result of a calculation is represented as ‘*’ characters.Graphic expressions can be arrays (see Type E).

SYNTAX
G<value per ‘*’><expression>

EXAMPLE

performance, 10 G1000 [sales]

I INVISIBLE DESCRIPTION
The contents of the field are displayed as ‘*’.SYNTAX
I

EXAMPLE

password, 8 I

J JULIAN EXPRESSION DESCRIPTION
The result of a calculation is a date.SYNTAX
J<expression>

EXAMPLE

tomorrow, 6 J [system.date]+1

L SELECTION LISTS DESCRIPTION
This is a list of values to choose from. The source of the values can be a file, a command, or a list in the dictionary. Note that this should not be used where a Foreign Key could be used to better advantage. Lists are particular to the table in which they are defined, whereas foreign keys are generally available.Each list item has the form <value>{:<display>} where value is the value used if the item is selected and the optional display is the text to display when the user is selecting an item. The ‘:’ separates value from display. If display is not given, value is also used for the display.

SYNTAX
L!<command>|#<file name><list>

EXAMPLE

command is a shell command to execute to produce the list.

file name is the name of a file that contains the list.

list is a comma (,) separated list to use. It is the default if ‘!’ or ‘#’ are not the first character.

color, 6 LRED,YELLOW,GREEN,BLUE

user, 8 L!cat/etc/passwd | awk ‘{ print $1 “:” $5 }’

day, 3 L#days

where the file days contains SUN:SUNDAY MON:MONDAY TUE:TUESDAY WED:WEDNESDAY THU:THURSDAY FRI:FRIDAY SAT:SATURDAY SUN:SUNDAY

M MESSAGE DESCRIPTION
A “message” box which is implemented as an html “textarea”A “textarea” is an html object for entering many lines of text.

This field type is not available as a storage type and it can only be used in prompted scripts (ubprompt)

SYNTAX
M{C}<lines>

The attribute width is used to control the width of the textarea on the screen

The optional C is used to invoke ckeditor for html editing of the textarea.

EXAMPLE

message, 20 M5

N NUMBERS DESCRIPTION
Numbers are stored as text with the decimal point and thousands separators embedded in the field.Note that fields of type NF will always be displayed with any 0 after the decimal point (and possibly the decimal point) removed and the number right justified in the field.

Fields of type ND will always be displayed with the decimal point in the same position even when it is suppressed.

SYNTAX
N{<modifier>}{<decimal places>}{<default value>}

decimal places can be F for no fixed decimal places. The default decimal places is 0.+ indicates only values greater than or equal to zero may be entered .

C indicates suppress display of commas (‘,’). On data entry, the number will also be stored without commas.

D indicates suppress display of zeroes after decimal point.

F indicates there is no fixed number of decimal places. The number of decimal places used is determined by the operator input. Trailing zeroes are removed.

N indicates don’t sum this number for subtotals.

Z indicates suppress display of the number if its value is zero. Zero will be displayed as spaces instead.

EXAMPLE

qty, 6 N3

metres, 6 NF

length, 6 N+0

units, 5 ND2

onhand, 5 NZ0

P PICTURE DESCRIPTION
A picture or a text field that indicates allowable characters for each character position and any mappings such as lower case to upper case.

Valid characters for the 'pattern' characters are:
		a - Any letter (a-z, A-Z)
		A - Any letter but a-z are mapped A-Z, i.e. upper case.
		s - Any letter or a space
		S - Any letter or a space, but converted to upper case
		9 - Any digit (0-9)
		0 - Any digit or a space
		x - Any printable ASCII character
		X - Any printable ASCII character, but converted to upper
		      case

Any other pattern character is inserted directly in the field and skipped when editing.

Note that the last pattern character will be used for the remainder of the field if all positions are not defined.

SYNTAX
P<picture>

EXAMPLE

sales tax no, 10 P9-999-999

name, 30 PX

R REMOTE FILE DESCRIPTION
A “file upload” attribute implemented as an “input” element of type “file”.Browse for files on the local computer to upload to the server.

This field type is not available as a storage type and it can only be used in prompted scripts (ubprompt)

SYNTAX
R

EXAMPLE

image, 50 R

S SEQUENCE DESCRIPTION
An automatically allocated number that can only go up. It is zero filled. The initial sequence number can be set with ubmodtab(1).SYNTAX
S

EXAMPLE

order no, 6 S

T TOTAL EXPRESSION DESCRIPTION
An expression whose value is recalculated at sub-totals. This distinguishes the case where the sum of a calculation (e.g. average) is not the same as the calculation on the sum.SYNTAX
T{<modifier>}{<decimal places>}<expression>

EXAMPLE

avg cost, 10 T2 [extended cost] / [qty]

U UNION DESCRIPTION

The concatenation of several fields or strings to form a new field. Note that the fields may be subfields.

SYNTAX

U <fields>|<text>|<commands> ...

EXAMPLE

sold, 10 U "Y" [stock no]
category, 1 U [stock no:1-1]
user, 8 U `who am i`

Leave a Reply