Supported Field Types

Documentation home

 

CHAR. 1

NUMERIC. 1

CURRENCY. 2

INTEGER. 2

BOOLEAN. 2

DATE. 3

TIME. 4

Timezone support 4

DATETIME. 5

OBJECT. 6

 

 

See also: Field Display Types, Internationalization Support

 

CHAR

 

CHAR fields represent  character values. Any data can be entered.

 

FPL script considerations:

Addition operations on character fields are treated as concatenation. e.g.

 

set A = 'Happy'; 

set B = A + ' Xmas';

 

A and B are both defined as CHAR fields. B will contain the value 'Happy Xmas'.

 

Javascript script considerations:

CHAR fields are normally represented as Javascript Strings and all Javascript String operators and functions can be used e.g.

 

var char1 = fields.CHARFIELD.value;    // char1 is a Javascript String

char1 += " xyz";

var char2 = char1.toUpperCase();

var char3 = char1.toLowerCase();

var char4 = char1.trim();

var char5 = "rstuvwxyz";

var char6 = char5.substring(char5.indexOf("x"));   // char6 is xyz

 

Consult any Javascript reference for details of available String functions.

 

In general, a CHAR field value will always be represented in Javascript as a String. However, if necessary, a variable can be explicitly converted to a String like this:

 

var char6 = fields.MYFIELD.value + "";

 

The Javascript RegExp class can be used for pattern matching of regular expressions.

 

Resource mapping considerations:

CHAR fields can be mapped to any character-type resource field type e.g. CHAR, VARCHAR, LONGVARCHAR etc, plus the TIME type.

 

 

NUMERIC

 

NUMERIC fields represent  numeric values with a specified number of decimal places. The number of decimal places attribute in the field properties dialog specifies the number of decimal places allowed.

 

Presentation considerations

Numeric fields are formatted according to the formatting language in use for the form being executed. Formatting commas and periods are inserted according to the formatting rules for the language - these formatting rules can be viewed using Server Administration – Languages, select a language then see Format section. Similarly, commas and periods can be entered by the end user.

 

FPL script considerations:

All mathematical operations are possible. (See FPL Script Command Syntax for more information). Rounding will be applied to the results of calculations as specified by the rounding options in the field properties dialog.

 

Javascript script considerations:

NUMERIC fields are normally represented as Javascript numbers which support standard numeric operators e.g.

 

var num1 = fields.NUMFIELD.value;     // num1 is a Javascript number

var num2 = (num1 * 6)/100;

 

The Javscript Math class also contains many mathematical functions. Consult any Javascript reference for details.

 

In general, a NUMERIC field value will always be represented in Javascript as a number. However, if necessary, a variable can be explicitly converted to a number like this:

 

var num3 = +fields.MYFIELD.value;

 

Resource mapping considerations:

NUMERIC fields can be mapped to any numeric-type resource field type e.g. NUMBER, DECIMAL, INTEGER, SMALLINT, FLOAT etc.

 

 

CURRENCY

 

Currency fields are treated the same as numeric fields except that the decimal places are always displayed to the end user. e.g. for a currency field with 2 decimal places, a value of 99 is displayed as 99.00, a value of 23.1 is displayed as 23.10 etc. The number of allowable decimal points defaults to 2 and can be changed if required. (See Numeric fields for more information)

 

 

INTEGER

 

INTEGER fields represent numeric values with no decimal places.

 

Presentation considerations

Integer fields are formatted according to the formatting language in use for the form being executed. Formatting commas or periods are inserted according to the formatting rules for the language; these formatting rules can be viewed using Server Administration – Languages, select a language then see Format section. Similarly, commas or periods can be entered by the end user.

 

FPL script considerations:

All mathematical operations are possible. (See FPL Script Command Syntax for more information)

 

Javascript script considerations:

Same as for NUMERIC fields.

 

Resource mapping considerations:

INTEGER fields can be mapped to any numeric-type resource field type e.g. NUMBER, DECIMAL, INTEGER, SMALLINT, FLOAT etc. When reading in data from a mapped resource field with decimal points, the decimal points will be removed.

 

 

BOOLEAN

 

BOOLEAN fields can only have a value of 'Y' or 'N', and the default value is 'N'.

 

Presentation considerations

Boolean fields can only be displayed with a display type of checkbox. If a boolean checkbox field is marked as mandatory, a missing mandatory field message will be generated unless the checkbox is checked. This can be used to ensure a user clicks a checkbox e.g. "Click here to accept these conditions......".

 

FPL script considerations:

BOOLEAN fields can be queried as follows:

 

if [ A = 'Y']......

 

Javascript script considerations:

BOOLEAN fields are normally represented as Javascript booleans which support standard boolean operators e.g.

 

if (fields.BOOLFIELD.value)

..

 

BOOLEAN fields can be set from Javascript booleans:

 

fields.BOOLFIELD.value = true;

fields.BOOLFIELD.value = system.securityManager.isUserLoggedOn();

 

Resource mapping considerations:

BOOLEAN fields can be mapped to any character-type or bit-type resource field type e.g. CHAR, VARCHAR, BIT etc.

 

 

DATE

 

DATE fields represent  a date. Timezone support is optional.

 

Date Literals

When a specific date value is specified in the Verj.io Studio e.g. as a date literal in a script or as a default value for a field, the format must correspond with the format specified in parameter Date Literal Format which is specified separately on the studio and server: both parameters should have the same specification.

 

 

Presentation considerations

Date fields are formatted according to the formatting language in use for the form being executed. These formatting rules can be viewed using Server Administration – Languages, select a language then see Format section. Similarly date fields entered by the end user should be in the same format.

 

FPL script considerations:

Mathematical operations on DATE fields can be performed.

 

set DATE1 = DATE1 + 10;

 

adds 10 days to field DATE1.

 

FPL functions:

 

addmonth

adds one or more months to a date

addweek

adds one or more weeks to a date

addyear

adds one or more years to a date

datepart

a string representing part of a date e.g. Wednesday, August etc

datetostring

converts a date field to a character field and optionally applies regionalized formatting

dayofweek

returns a string representing the day of the week e.g. Friday

formatdate

formats the date as a string e.g. Tue July 10, 1996

joindatetime

see DATETIME type

splitdate

see DATETIME type

 

See FPL Script syntax for more details on the use of these functions.

 

Javascript script considerations:

The value of a DATE field is the number of milliseconds since 1st January 1970.

This can be used to create a Javascript Date object:

 

var date1 = new Date(fields.DATEFIELD.value);  
var date2 = new Date();       // current date 
 
The date can then be manipulated using standard Javascript Date functions e.g.
 
date1.setDate(date1.getDate() + 7);       // add a week

 

And the date can be saved in the form field e.g.

 

fields.DATEFIELD.value = date1;

 

Formatting date/time fields

Fields of type DATE, TIME or DATETIME can be formatted using the DateServices.formatDate() method e.g.

 

DateServices.formatDate(fields.DATEFIELD.value, "EEE, MMM d");      // Tue, Aug 21

DateServices.formatDate(fields.TIMEFIELD.value, "h:mm a");          // 2:26 PM

DateServices.formatDate(fields.DATETIMEFIELD.value, "yyyy.MM.dd G 'at' HH:mm:ss z");      // 2012.08.21 AD at 14:28:37 BST

 

Resource mapping considerations:

DATE fields can be mapped to resource fields of type DATE (date, but not time) or TIMESTAMP (both date and time).

 

 

TIME

 

Timezone support is optional.  Time fields can be used to represent a time of day to an accuracy of one thousandth of a second.

 

Presentation considerations

The display of time fields is configured using the date/time field options (in the Presentation tab of Field Properties). Options are available to display time fields as format hh:mm, hh:mm:ss or hh:mm:ss.ttt.

 

By default, time fields are displayed as hh:mm:ss.ttt using a 24 hour clock, but note that the :ss.ttt portion is only displayed if the field contains a value other than zero e.g. a time field with value 10:30:00.000 will be displayed as 10:30, a time field with value 10:30:49.000 will be displayed as 10:30:49. 

 

Time fields can be entered as either hh:mm, hh:mm:ss, or hh:mm:ss.ttt. The entry of a time field is not affected by the display format.

 

The presentation and validation of time fields does not vary based on language.

 

See also formatting date/time fields.

 

FPL script considerations:

When mathematical operations are performed on TIME fields, all values are interpreted as a whole number of seconds.

 

e.g. to add 30 seconds to a time field:

 

set TIME1 = TIME1 + 30;

 

to add 30 minutes to a time field:

 

 set TIME1 = TIME1 + (30 * 60);

 

FPL functions:

 

joindatetime

see DATETIME type

splittime

see DATETIME type

timetostring

converts a time field to a character field

 

See FPL Script syntax for more details on the use of these functions.

 

Javascript script considerations:

The value of a TIME field is the number of milliseconds since midnight.

This can be used to create a Javascript Date object:

 

var time1 = new Date(fields.TIMEFIELD.value);   
var time2 = new Date();       // current time 
 
The time can then be manipulated using standard Javascript Date functions e.g.

 

time1.setHours(time1.getHours() + 1);         // add 1 hour

 

And the time can be saved in the form field e.g.

 

fields.TIMEFIELD.value = time1;

 

See also formatting date/time fields.

 

Resource mapping considerations:

TIME fields can be mapped to resource fields of type TIME or TIMESTAMP. When mapped to a TIMESTAMP field (which contains both date and time)., the date portion of the TIMESTAMP is ignored.

 

Timezone support

Support for timezones is specified with server properties Use System Timezone and Timezone.

 

Property Use System Timezone:

 

 

 

DATETIME

 

Timezone support is optional. Datetime fields can be used to represent a moment in time to an accuracy of one millisecond, where the moment in time includes both date and time. 

 

Presentation considerations

Datetime fields are displayed as a date part followed by a time part.

 

The date part is formatted as for DATE fields.

 

The time part is formatted as for TIME fields.

 

See also formatting date/time fields.

 

FPL script considerations:

When presented to an FPL script, all values are rounded to a whole number of seconds. Therefore, mathematical operations are performed on DATETIME fields using a whole number of seconds:

 

e.g. to add 30 seconds to a datetime field:

 

set DATETIME1 = DATETIME1 + 30;

 

to add 30 minutes to a datetime field:

 

 set DATETIME1 = DATETIME1 + (30 * 60);

 

FPL functions:

A DATETIME field can be split into its date and time components using the splitdate and splittime functions e.g.

 

set DATE1 = splitdate(DATETIME1);

set TIME1 = splittime(DATETIME1);

 

where DATE1 is a field of type DATE and TIME1 is a field of type TIME.

 

Similarly a DATETIME field can be created from a DATE and a TIME field using the joindatetime function e.g.

 

set DATETIME1= joindatetime(DATE1, TIME1);

 

These functions are intended to allow TIMESTAMP resource fields (which contain both date and time) to be retrieved from a database or XML document, split into their constituent date and time parts for display to the end user, then re-combined for update of the database or XML document.

 

See FPL Script syntax for more details on the use of these functions.

 

Javascript script considerations:

The value of a DATETIME field is the number of milliseconds since 1st January 1970.

This can be used to create a Javascript Date object:

 

var datetime1 = new Date(fields.DATETIMEFIELD.value);   
var datetime2 = new Date();       // current date/time 
 
The date/time can then be manipulated using standard Javascript Date functions e.g.

 

datetime1.setHours(datetime1.getHours() + 1);     // add 1 hour

datetime1.setDate(datetime1.getDate() + 1);       // add 1 day

 

And can be saved in the form field e.g.

 

fields.DATETIMEFIELD.value = datetime1;

 

See also formatting date/time fields.

 

Resource mapping considerations:

DATETIME fields can be mapped to resource fields of type DATE, TIME or TIMESTAMP. When mapped to a DATE field,  the time portion is set to 00:00:00 on write operations to a resource. When mapped to a TIME field, the date portion is set to the current date on write operations to a resource.

 

OBJECT

Fields of type Object can be used to store complex objects that are not supported by any of the other types. Values can only be read and set using Javascript. All field values are serialized/deserialized and therefore all objects saved as values in this way must implement the Java Serializable interface, click here for further details. Any object can be saved in a field of type OBJECT if it is serializable.

 

Presentation considerations

Fields of type Object are not intended to be presented to the user. If this is done, a serialized value will be displayed.

 

Script considerations:

Values can only be get and set using Javascript.

 

When a field of type OBJECT is passed to another part of the Verj.io system, then the field’s stringValue property should be used instead of the field’s value property. This applies to:

 

Click here for more information and restrictions that apply when Javascript objects are stored in form fields of type Object.

 

Resource mapping considerations:

Fields of type Object can be mapped to a resource field of any type.

For Database Resources, all column types can be read, and columns of type BLOB, CLOB and any other character type are supported for update.