Data types in sanScript

Dexterity uses several different data types to specify how information is stored and displayed in fields. When writing scripts, it’s important to know how information in a field using a particular data type is stored, so you’ll know how script commands will control the information.

Storing data types

Fields can store data in the following standard forms: boolean, currency, integer, long, string, text, date, time, and variable currency. The control type used for the data type determines how a particular field stores information. The following table lists each storage type, its description, and the control types that use that storage type.

[spacer]

Storage type

Description

Control types

Boolean

A value of either true or false.

Boolean

Check box

Currency

A currency value in the range [-99,999,999,999,999.99999 to 99,999,999,999,999.99999]. The decimal point is implied in the number, but not stored. For display purposes, currency values are limited to 14 digits to the left of the decimal and 5 digits to the right.

Currency

Integer

An integral number in the range

[-32768 to 32767].

Button drop list

Drop-down list

Group box

Integer

List box

Non-native list box

Progress indicator

Visual switch

Long

An integral number in the range [–2,147,483,648 to 2,147,483,647].

Long integer

String

A sequence of up to 255 characters.

Combo box

String

Text

A sequence of up to 32,000 characters.

Text

Date

Date based upon the Julian calendar.

Date

Time

Time based on the 24-hour standard.

Time

DateTime

A combined date and time value used for COM integrations.

None

Variable Currency

A currency value with up to 23 digits. Up to 15 digits of the number can be used for the decimal portion.

Currency (variable)


String and text data types are stored as Pascal strings in a data file. Pascal strings use a length byte (1 byte for strings, 2 bytes for text) to store the length of the field. Typically, these data types must also have an even storage size. If the sum of the storage size and length byte is an odd number, a pad will be used when you set the storage size for the data type. Even storage sizes are required for microprocessor compatibility.

The other control types not mentioned in the previous table either don’t store information or store information in a format unique to the control type. Push button, radio button, reference, tree view and list view control types don’t store information. Composite, multi-select list box and picture control types each store data in their own unique format.

Converting data

When working with fields in scripts, it may be necessary to convert how the data is stored to a different storage method. This conversion can happen implicitly or explicitly.

Type conversion happens implicitly in many situations. For instance, if an integer value and a currency value are added together in an expression and the result is stored in a currency field, the result would be a currency. If the result of the same expression was stored in an integer field, the result would be an integer. The conversions that occur depend on where the result is stored.

To explicitly convert a string to a numeric value, use the value() function. To explicitly convert a numeric value to a string use the str() function. For more information about each of these functions, refer to the SanScript Reference manual.

You can also use casting to convert values from one type to another. Refer to Casting for more information.


Documentation Feedback