You are viewing the Resources for the older version of JourneyApps (V3). JourneyApps V4 is the new default for all new apps since July 1, 2016.

Attribute & Variable Types

Attributes in your Data Model and variables in your Views are set up to store a specific kind of data — which can be any of the following:

Attribute Type Details Example

int

Integer value. minValue and maxValue specify the minimum and maximum values, respectively. 100

decimal

Floating-point value. 3.14

string

Textual value - anything from a short name to longer paragraphs.

Some variations are defined for strings, which affect the input method shown to the user on a mobile device, and may provide additional validations. The variation is specified in the spec attribute of the Data Model — please refer to the String Specs section below.
"John Doe"

date

Represents a date in the Gregorian calendar, for example "2012/05/17". Not tied to any timezone. 2012/05/17

datetime

Represents a specific date & time combination. Time is always displayed in the local timezone. For example, "2012/05/17 12:15:48" in UTC will be displayed as "2012/05/17 14:15:48" on a device configured for GMT+2. 2012/05/17 12:15:48

location

Represents a set of GPS coordinates. This includes:
  • latitude
  • longitude
  • altitude
  • horizontal_accuracy
  • vertical_accuracy
  • timestamp
Capturing of altitude and vertical_accuracy is not supported on many devices

enum

Represents a single choice from a list of options, for example "gender" or "province". Options are specified as a list of human-readable strings.

When you access an enum value from JavaScript, the value the 0-based index of the selected option (in other words, the position of the selected option if you start counting at zero).
For example, if the options are "Male" and "Female", and "Female" option was selected, the value when accessed from your JavaScript code would be:
1

enum_set

Same as an enum, but multiple values may be selected.

When you access an enum_set value from JavaScript, the value will be an array of 0-based indexes of all the selected options (in other words, the position of the selected options if you start counting at zero).
For example, if the options are: "Checked oil", "Checked type pressure" and "Checked washer fluid", and the first two were selected, the value when accessed from your JavaScript code would be:
[0, 1]

attachment

Represents a binary file. The media attribute defines the file format, as an Internet media type (originally called MIME types). The only two types currently supported are:
  • image/jpeg for pictures

  • image/svg+xml for signatures.



String Specs

As discussed above, some variations/specs are defined for strings, which affect the input method shown to the user on a mobile device, and may provide additional validations.

To use one of these specs, add spec="" to a string attribute definition, for example:

The following string specs are available:

Spec Details
text The default - any characters are allowed.
text.email Email address.
text.address Street address, suburb or city. Words are automatically capitalised.
text.name Person or other name. Words are automatically capitalised.
text.url Web URL.
text.paragraph A multi-line block of text. Renders as a paragraph rather than as a single line.
number Only digits are allowed.
number.za_id South African ID number. Length and check digit are validated in inputs.
phone Represents a phone number.
decimal Digits are allowed, as well as a decimal point.
password Characters are hidden when entered.