Datatype Default Values and Limitations

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:
    • Where NULL is supported – the device application receives the rows where the attribute in the MBO is NULL. If a synchronization parameter or load argument is NULL, then data refresh is performed using the value NULL.
    • Where NULL is not supported – if associating synchronization parameter X with attribute X, the download cursor is similar to:
      select ... from my_table t where t.last_modified >= ... and t.x >= :X
      If X is NULL, no rows are returned, since (t.x >= :X) is false in the database if X is 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.

The total length of an MBO synchronization parameter cannot exceed its pagesize

If an MBO's total length (sum of maxLength) of a synchronization parameter's exceeds its pagesize, an exception is thrown during code generation. When calculating how many BYTEs it takes compared to pagesize, consider that for:
  • String type, the length is 4*maxLength. In the MBO model, string maxLength is by character.
  • Byte[] type, the length is just maxLength.
  • Decimal and Integer types, the length is its precision.
  • Other types(int, long, and so on), length can be safely ignored when giving a bit larger margin.
Ensure that the MBO developer uses a larger pagesize or makes the synchronization parameter maxlength smaller.

Setting default values for String, BigString, Binary, and BigBinary datatypes

When editing the default value of parameters/arguments, a dialog allows you to set the default value if the data type of the parameter/argument is String, BigString, Binary or BigBinary. The maximum length for the default value is 16K:
  1. For BigString,Binary, and BigBinary, open up a dialog to edit the default value.
  2. For String of length greater than 300, open a dialog to enter the default value, otherwise, edit it directly in the cell.

    You can enter default values directly, or select the radio button Import from file and Browse to retrieve the default value from a file.

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.

Negative values

BYTE datatype range is 0-127 if targeted for .Net (C#) device platforms. Negative values are not supported for BYTE datatypes, otherwise synchronization may generate PersistenceException errors.