Offline - Data synchronization¶
Data synchronization is split up into
-
Global settings
-
Configuration (use case) specific settings
Global settings¶
Global settings are modified in the config.js file (s. chapter Requirements)
-
"offlineSupport": true -> switch on offline support
-
"autoSync": true -> upload data whenever connection is available
-
"downloadInterval": 15 -> in case of autoDownload (see Download strategy) a download takes place 15 min after finishing the previous download
-
"downloadOnOnline": true -> immediate download after reconnection
Download strategy¶
Principle: Insight Mobile performs a complete download of the data model, from the instances of the root node down to the instances of every sub node.
Strategies: Insight Mobile offers three different download strategies which can be defined for each Insight Config configuration.
-
Automatic: "auto", "auto_view"
-
On demand: "view", "auto_view"
-
Online only: "onlineOnly"
-
No download: default
Options:
"auto" automatic download.
"view" user triggered download via synchronization view.
"auto_view" activates both options.
"onlineOnly" UseCase is only accessible when being online.
"download": {
"mode": "auto_view"
}
The choice of download strategy should reflect:
-
Expected amount of data (automatic download is recommended only for a data load up to 10'000 records in a flat structure or 100 objects in a deep structure)
-
That complex routines should be running on the server
-
That user specific properties should be used to optimize/individualize the data load (see queryParams, Filtered Download)
Example 1: List of running work orders assigned to the crew of the logged in user
- Automatic download
Example 2: Deep structure starting from location hierarchy / assets / spare parts / technical documentation for one complete site
- On demand download
Example 3: List of work orders which are waiting for approval.
Working templates should be assigned and copied to the work order (which is done with of a routine running on the server)
Work should be handed over to the maintenance crew as fast as possible.
- No download
Across users download¶
With the "acrossUsers" switch, downloads can be saved on the device for all users. The downloads are retained on the device when the user changes. If "QueryParams" are set, they must match. Downloaded documents are not retained and are removed from the device.
"download": {
"mode": "auto_view",
"acrossUsers": true
}
Filtered Download¶
"queryParamFilter" is used to optimize the amount of offline data.
Precondition:
corresponding queryParam has to be defined in the node specific queryParams Array.
"queryParams": [
{
"name": "storeroom",
"attribute": "LOCATION"
}
],
See "queryParams" for further information how to filter (root) nodes regarding user specific properties such as personid or crewid.
Behavior:
-
User (can) select one of the presented filter values
-
Insight Mobile uses the selected value and the defined attribute ("queryParam") to add an additional constraint to the defined root query before it starts its download routines
Filter value selection can be configured by referring to the values of a further Insight Configuration ("tree"):
"clientProperties": {
"queryParamFilter": {
"queryParam": "storeroom",
"tree": "storeroom",
"node": "Lagerort",
"attribute": "${LOCATION}"
}
}
or by listing distinct options:
"clientProperties": {
"queryParamFilter": {
"queryParam": "storeroom",
"options": [
{
"label": "MAIN SR",
"value": "MAIN SR"
},
{
"label": "OIL SR",
"value": "OIL SR"
}
]
}
}