Data transforms in offline mode
Offline-enabled mobile apps support an extensive use of data transforms. With data transforms, you can save time and improve the developer experience by reducing the need for writing custom JavaScript functions.
Packaging
To use data transforms in an offline-enabled app, Pega Platform packages data transforms that match the supported features on the server. The packaging process converts the logic in the data transform to an equivalent JavaScript code on the client.
By default, the system packages the data transforms that you configure in the following components:
- Flow connectors
- Flow actions as preprocessing or postprocessing data transforms
- Display refresh actions in controls
- Run data transform actions in controls (in either the default or other page context)
- Apply data transform step actions in other data transforms
The structure of the packaged data transforms resembles the original model of the data transform and contains only the elements that are relevant for offline-enabled apps. If a data transform matches an unsupported scenario, the offline-enabled app does not process the data transform and the system logs an error.
If an offline-enabled app runs the data transform by using a Run script action or a custom JavaScript function, the system does not automatically package the data transform. You can add these types of data transform rules to the list of offline-supported data transforms to enable their use in offline-enabled apps.
Supported elements of data transforms
Offline-enabled apps support the following actions for data transforms:
- Set
- Update page
- Append to
- Append and map to
- Remove
- When
- Otherwise when
- Otherwise
- Sort
- Comment
- Apply data transform
- Exit data transform
- For each page in
- Exit for each
Unsupported scenarios
Offline-enabled apps do not support data transforms in the following scenarios:
- A source field contains the at sign (@) outside of the quotation marks (" ").
Library functions are not supported in offline mode. Configure the source field to contain expressions such as plus (+) or spaces as an alternative solution.
- A condition contains the at sign (@).
Library functions are not supported in offline mode. Use client-side expressions as an alternative solution.
- A condition does not contain a dot (.).
Server-side when conditions are not supported in offline mode. Use client-side expressions as an alternative solution.
- A page list index or page group index uses a property reference, for example,
pyWorkPage.MyPageList(pyWorkPage.MyIndex)
where thepyWorkPage.MyPageList
page list uses thepyWorkPage.MyIndex
property reference as its index. - Parameter pages and list-related keywords, such as APPEND, INDEX, LAST, are not supported in offline mode.
Additional considerations
In offline-enabled apps, when data transforms evaluate conditions, these evaluations are resolved in accordance with the principles of loose equality in JavaScript.
For properties that evaluate to a true Boolean (true, yes), the condition of a When data transform is met for the following values:
- 1
- "1"
For properties that evaluate to a false Boolean (false, no), the condition of a When data transform is met for the following values:
- ""
- 0
- "0" or any number of zeros in quotation marks (for example, "0000")
Previous topic Function rules in offline mode Next topic Data synchronization in offline mode