This topic provides information about datatype default values that can be set for mobile business object (MBO) attributes, arguments, and parameters.
You can provide a default value for attributes and parameters that are compatible with their datatype (and used by the device application to pass to the MBO), where ever you specify a datatype (Properties view, Preview dialog, and so on).
Note: When possible, the default value is retrieved with an appropriate value from the data source when you bind to the data source, which you can then modify.
NULL and empty default values
It is important to understand the differences between the default values NULL and no default (leaving the default value empty):
- NULL – datatypes that do not support NULL or the load
argument/operation argument property 'Nullable' is not selected, typically
do not list it as an option from the drop-down list. After an MBO is
created, NULL may be an available default value, but should not be selected
if NULL is invalid for that datatype or is otherwise problematic (for
example, you would not allow NULL for a primary key). If NULL is selected,
and is invalid for the datatype, errors occur either when you deploy the MBO
to Unwired Server, or when a device application interacts with the deployed
MBO. These examples illustrate how a device application behaves when an MBO
contains a synchronization parameter equal to NULL:
- empty default value – an empty string is not the same as no default. For string and binary datatypes, an empty string is a valid default value. For other datatypes, an empty string is invalid and generates an error.
The default value is set according to the nullability and datatype of the argument, synchronization parameter, or personalization key. For nullable types, the initial default value is set to NULL, for non-nullable types, a valid value is set according to the datatype (for example, string "", boolean "false", decimal "0", integer "0", float "0", and so on).
The default datatype length, if you do not specify one, including migrated datatypes, is:
- STRING – 300
- BINARY – 32767
Note: When STRING and BINARY are set to default values, a warning displays indicating the
possibility that data truncation during runtime if the EIS column and the associated
data are greater than the aforementioned default settings. As the MBO Developer, use
your EIS data source knowledge and judgement to avoid data truncation and at the
same time, maximize efficiency and performance by modifying the default to a
suitable length. For example, instead of using a string datatype, use string(30) if
it meets the needs of your mobile application.
Valid, supported value range for DateTime datatypes
When a DateTime value is stored in the database, it will only be represented accurately if it is within the range
1600-02-28 23:59:59 to 7911-01-01 00:00:00.
Attempting to store dates outside this range may result in incomplete and inaccurate information.