Datatypes¶
There are multiple data types, including:
String Datatype¶
Definition¶
A text value.
The maximum length of the string can be indicated.
Optionally a regular expression pattern can be entered in the pattern field of the cde definition
Examples¶
- hello world ( a string containing a space)
- Mary ( a word)
- ” ” ( blank no quotes)
- The string 123
- ^^%%$^%$ff ( non alphanumeric characters )
Integer Dataype¶
A whole number. Integer DEs can have a max or min value entered.
Examples¶
12, -1,0 etc.
Range Datatype¶
For more sophisticated DEs, a DE can incorporate Permitted Value Groups (PVG).
Definition¶
A set of allowed values (usually represented as drop down list)
Ranges in RDRF are specified by the datatype keyword “range” and then selecting the appropriate Permitted Value Group This entails that permitted value groups be created first.
Examples¶
- shoe size : big, medium, small
- colour: red, blue , green
Calculated (Derived Data Element)¶
Definition¶
A value which is computed client-side from other values on the form.
To created a calculated DE enter “calculated” as the datatype and then fill in the calculation field of the DE.
Examples¶
A calculation (for BMI) could be coded as:
var height = parseFloat(context.CDEHeight);
var mass = parseFloat(context.CDEMass);
context.result = mass / ( height * height );
The “context” here is an abstraction representing the other cdes on the containing form. (Hence these other DEs must be present in some section of same form as the form containing the calculated field, else an error will result).