Attributes and Expressions
Attributes
DataSplice uses attributes to define variables that can be used throughout the configuration to tailor how things behave, such as:
- Control various functions of DataSplice applications and plug-ins
- Access data from the current context
- Define commonly used values
Attributes are referenced using the following syntax: ${ATTRIBUTE_NAME}. This will replace the value of the attribute with the name ATTRIBUTE_NAME when the setting that references it is used.
Naming convention for attributes make it easier to distinguish attributes defined for different purposes. UPPER_CASE names help separate custom attributes from the values available through the current record that are typically Mixed Case. In addition, all attributes used by the various DataSplice products have a common DS_ prefix.
Attribute Hierarchies
The feature that makes the attribute mechanism particularly powerful is that attributes can be defined at many different levels and can be overridden depending on precedence rules. Attributes can be specified at various levels
- System - The system provides several built-in
attributes that are always available. For instance, DS_USER contains
the current user name.
- Roles - Attributes
from the roles the user is a member of can be used to define frequently
used values within a particular application.
- Views - Each view can also contain customized control its behavior, perform lookups into other views, etc.
- Plug-ins
- Client-side plug-ins can define events and expose values through
attributes. For instance, the barcode value scanned by the user is
available through the DS_SCANNER_INPUT attribute.
- Session - Attributes can be persisted to the user's session to track maintain values across multiple events.
- Current Record
- The values of the selected record are also available as attributes
using the field name. This allows the current values to be accessed
using the same syntax as for other configuration settings.
The above attributes are combined in a hierarchical manner to generate the collection of values available when various events occur. For instance, when committing record changes to the server, you can access built-in attributes, values defined by the user's roles, and data from the selected record using the ${NAME} syntax.
Expressions
Many settings in DataSplice are specified by expressions that are evaluated to determine whether or not certain behavior should be available. This allows many of the conditions and other settings for views to offer much more dynamic behavior. So rather than simply saying a record is or is not editable, the administrator can specify it is editable if a specific condition is true.
Dynamic Attribute Values
This behavior is also extremely useful for defining attributes. At times it is useful to define an attribute value when it is used, not when it is defined. Dynamic attributes get their values by evaluating an expression, which in turn can reference other attributes, access data in other views, and test complex conditions.
Dynamic attributes are processed by both the DataSplice Server and the Remote Clients, so they work online as well as offline.
These attributes can be used for a wide range of tasks:
- Look up values, such as default codes, associated with the current log in to reference in filters and defaults.
- Fill out basic information for newly inserted records, like locations and descriptions.
- Using existing restrictions from the master application as mandatory filter criteria.
The syntax for specifying a dynamic attribute is := <expression>, where <expression> uses the DataSplice expression syntax.
Attribute Validation
DataSplice 3.1 will display errors when processing attributes and expressions, unlike prior versions that simply consumed the error and continued processing the current action. This is extremely helpful in diagnosing configuration errors, but it does require that settings are defined correctly or users will encounter these errors while using the system.
In addition, most of the settings that can reference expressions will attempt to validate the configured setting and display the value in bold red text if an error is detected.

In these cases, the extended text editor can be displayed which will contain the actual parsing or error message. This is very helpful to ensure you are composing correct expressions throughout the configuration.
- Use the error message to determine the syntax error or other problem and correct it.
- In many cases errors will be displayed for views when not masquerading as a user with access to the appropriate role. This is because the expressions reference attributes defined by those roles.
- In some cases errors can be ignored because the validator does not have access to all the values that will be present when the expression will actually be evaluated.
Basic Syntax
Expressions are written as generic logical statements, similar to SQL where clauses. Normal operator precedence rules are followed. Parentheses can be used to arbitrarily group items. The following operators are understood:
+Numeric addition-Numeric subtraction*Numeric multiplication/Numeric division||String concatenation<=>Comparison - returns -1 if the left argument is less than the right one, 1 if it is greater, and 0 if they are equal (Spaceship operator!)!Boolean not operator, i.e.:!isModified()is nullis not null=or==Equality test!=or<>Inequality test>Greater than<Less than>=Greater than or equal<=Less than or equallikeThis processes%characters as wildcardsnot likebetweenInclusive bounds test (ie:${Value} between <min> and <max>)not betweenandor
Text operators are not case sensitive. Also note that separate operators are used for addition and string concatenation.
Expression Functions
In addition to these operators, many built-in functions are available that allow expressions to specify complex conditions. Refer to the Expression Function section in the addendum for a list of available functions and documentation about the syntax.
Explanation of Built-in System Attributes
The following is a brief explanation of the built-in system attributes. The format used is as follows:
- Assume Modifications (DS_ASSUME_MODIFICATIONS) - Determines whether or not the Remote Client application will re-query a record after changes are committed. This may be useful if other non-DataSplice changes may have affected the record, such as database triggers.
- Auto Commit Changes (DS_AUTO_COMMIT) - When enabled, changes on the Remote Client are immediately submitted to the DataSplice Server when the new or updated record loses focus. Thus, when this attribute is enabled, it is no longer necessary to use the Save Changes button to commit changes on the Remote Client.
- Auto Reload (DS_AUTO_RELOAD) - When enabled, this attribute causes the view data to be refreshed when a record is saved or a view is navigated to.
- Date Format (DS_DATE_FORMAT) - This attribute defines how dates are formatted. It uses the same syntax as that in the "date formatting":formatspecs section.
- Decimal Precision (DS_DECIMAL_PRECISION) - This attribute specifies the number of decimal places to be displayed given a floating point number. The attribute is given an integer value. An example of this is for a number '1234.6789' with a decimal precision of
2would display as '1234.67'. - Default Filter Action (DS_DEFAULT_FILTER_ACTION) - This attribute specifies the initial behavior to undertake when a user hits the 'ENTER' key when currently selected on a filter. Available options are:
- Create Record - Brings up a new record for editing.
- Display Filter - Initially prompts the user for necessary criteria in order to perform the desired query.
- Display Grid - Initially displays a set of data showing multiple records.
- Display Record - Initially displays a single record at a time.
- Display:<Query Name> - Runs the specified query.
- Navigate Up - Moves the user to the parent of the current view.
- View Selection - Moves the user to the top level view list.
- Default Grid Action (DS_DEFAULT_GRID_ACTION) - This attribute specifies the initial behavior to undertake when a user hits the 'ENTER' key when currently selected on a grid. Available options are:
- Create Record - Brings up a new record for editing.
- Display Filter - Initially prompts the user for necessary criteria in order to perform the desired query.
- Display Grid - Initially displays a set of data showing multiple records.
- Display Record - Initially displays a single record at a time.
- Display:<Query Name> - Runs the specified query.
- Navigate Up - Moves the user to the parent of the current view.
- View Selection - Moves the user to the top level view list.
- Default Record Action (DS_DEFAULT_RECORD_ACTION) - This attribute specifies the initial behavior to undertake when a user hits the Enter key when currently selected in a single record display. Available options are:
- Create Record - Brings up a new record for editing.
- Display Filter - Initially prompts the user for necessary criteria in order to perform the desired query.
- Display Grid - Initially displays a set of data showing multiple records.
- Display Record - Initially displays a single record at a time.
- Display:<Query Name> - Runs the specified query.
- Navigate Up - Moves the user to the parent of the current view.
- View Selection - Moves the user to the top level view list.
- Message Timeout (DS_MESSAGE_TIMEOUT) - The amount of time, in
seconds, that the DataSplice Server will wait for a reply from a sent message request. - Offline Behavior (DS_OFFLINE_BEHAVIOR) - This attribute determines the intended offline usage. By default, the handheld is allowed to switch between online and offline mode if available. Available options are:
- Always Offline - The Remote Client is only permitted to function in
offlinemode. - Never Offline - The Remote Client is only permitted to function in
onlinemode. - Password Timeout (DS_PASSWORD_TIMEOUT) - The amount of idle time, in minutes, before the Remote Client will prompt the user to re-enter their password.
- Ping Interval (DS_PING_INTERVAL) - If the Remote Client application is idle for longer than this amount of time, it will attempt to ping the DataSplice Server before communicating to ensure that the connection is still valid. If this time is not exceeded, it will attempt to communicate to the DataSplice Server without pinging beforehand. This interval value is specified in seconds.
- Ping Timeout (DS_PING_TIMEOUT) - The amount of time, in minutes, that the client applications should wait for a ping reply before timing out.
- Records Per Page (DS_RECORDS_PER_PAGE) - The number of records to display on each screen when in grid mode on the Remote Client.
- Skip Offline Purge (DS_SKIP_OFFLINE_PURGE) - When this attribute is true, existing offline data on client devices will be retained during subsequent synchronization attempts.
- Use Transactions (DS_USE_TRANSACTIONS) - When true, this causes record commits to be performed in a transaction process.
Other Available Built-in Attributes
Some attributes are built into DataSplice but are not visible as settings in the Administration Client. These attributes, however, can be referenced throughout the application to provide additional functionality. The following is a brief explanation of those attributes.
- DS_USER - The user name of the user that is currently logged in.
- DS_DOMAIN - The domain that this user belongs to.
- DS_VIEW - The name of the current view.
- DS_APP - The name of the application in use, such as Remote Client.
- DS_APP_VERSION - The version of the application in use, such as 3,0,86,0.
- DS_CURRENT_TIME - The present date and time of the device or server that receives the request to populate the value. Depending on where this attribute is set, it may be populated with different values. If it is used in a view field setting, such as to make it a default value for a field on an insert view, then this attribute would be populated with the present date and time
on the client devicebeing used. For example, if this attribute is defined as the default value for a field in a DataSplice insert view, and a new record is created in that view on June 30, 2006 on the Remote Client running on a mobile device with a clock setting of 7:00pm, while the server computer it is connected to is in another time zone and has a clock setting of 5:00pm, the DS_CURRENT_TIME attribute value would be populated with6/30/2006 7:00:00 PM. Alternatively, if DS_CURRENT_TIME is referenced in the parameter bindings in an event chain, then this attribute is populated with the system time of the server that processes the request. Using the same example, if the attribute was set in the parameter binding in the event chain, rather than as the default value of a field, then it would be populated with6/30/2006 5:00:00 PM. - DS_EDIT_TIME - Primarily used for update processes, this attribute is populated at the time the update is performed,
based on the client deviceclock settings. For example, if a user performs a physical count on June 30, 2006 at 10:00am and synchronizes with the server at 2:00pm, the DS_EDIT_TIME attribute value would be populated with6/30/2006 10:00:00 AM. Contrary to the DS_CURRENT_TIME attribute mentioned previously which can be populated with a timestamp from either the client device or the server, DS_EDIT_TIME always gets the timestamp information from the client device, rather than the server. - DS_QUERY_NAME - The name of the executed query.
- DS_SCANNER_EXPRESSION - The barcode scanner plug-in will use this attribute to evaluate, and possibly override, the data value scanned in. If DS_SCANNER_EXPRESSION is not null, it will replace the scanned data with the result (see DS_SCANNER_INPUT).
- DS_SCANNER_FIELD - The barcode scanner plug-in will inject this attribute with the name of the selected field when the scan occured.
- DS_SCANNER_INPUT - The barcode scanner plug-in will inject this attribute with the value of the scanned data. It will then evaluate an attribute (you must define) named DS_SCANNER_EXPRESSION. If DS_SCANNER_EXPRESSION is not null, it will replace the scanned data with the result.
- DS_SCANNER_INPUT_RAW - The barcode scanner plug-in will inject this attribute with the value of the scanned data.
- DS_SCANNER_QUERY - When set to a name of a query in the current view, the scanner will execute the query with the following attributes supplied; DS_SCANNER_INPUT_RAW <-- the value of scanner input before evaluating DS_SCANNER_EXPRESSION, DS_SCANNER_INPUT <-- equal to DS_SCANNER_INPUT_RAW before evaluating expression (when used in DS_SCANNER_EXPRESSION) then changed to resulting output of DS_SCANNER_EXPRESSOIN if not null.
- DS_SCANNER_VIEW - if DS_SCANNER_VIEW evaluates to non-null, and the user is not on that view, DataSplice will automatically navigate the user to the view with the name matching DS_SCANNER_VIEW.