Projection¶
The following sections detail the marble capabilities for mobile app. Anything not specified should be considered as unsupported.
Entity Set Where¶
entityset ReliableCustomers for Customer {
offlinefilter = [CreditRating > 5];
}
Using the where property on an Entity Set will not work in the offline client. The client does not have direct access to the server database and cannot run PLSQL against the client database. Instead an offlinefilter
expression must be used. This will allow queries on attributes and references within the entity.
Array Where¶
array ReliableCustomers(Company) to TstCustomer(Company) {
offlinefilter = [CreditRating > 5];
}
Using the where property on an array will not work. This is for the same reason as the entity set where. Instead an offlinefilter
expression must be used. This will allow queries on attributes within the child entity. References to the array parent are not supported in offline filters.
Sync Policies¶
syncpolicy Batch {
syncschedule = daily at 20:00;
}
Entity data is updated on the device based on the sync policy selected. The data in the client database may not always be as up to date as the server data. Once data has synced from the server to the client it will not change until the next time the sync policy defines. This is important to consider when using queries or fetch within an attribute. The data will not update automatically based on client-side updates.
Sync Policy: ClientCache¶
syncpolicy ClientCache {
cacheinvalidation = after 2 hour;
}
An entity with the ClientCache
sync policy it will not have any data sent to the client as part of the initialize process. When a user first goes to a screen requiring data from this entity it will be downloaded and stored locally to be used again for the next request. The client cache can have expiration period which will trigger the client to refresh the data from the server. If the user accesses the data after the cache has expired and while offline, the cached data will be used until the user goes online. If data for a ClientCache
entity is used within a client procedure it will be retrieved before the procedure is executed.
Sync Policy: OnlineOnly¶
syncpolicy OnlineOnly;
An entity with the sync policy OnlineOnly
will have the data retrieved from the server every time the user goes to a screen that uses that entity. If the user is offline the data will be unavailable. OnlineOnly
entity data is not accessible from within client procedures.
Attributes¶
prefetch
for references is not supportedcompute
attributes are not supportedvalidate
is not currently supportedStream
attributes types are not supported
Binary Attributes¶
Be wary of using Binary
attributes. Binary data is stored against the row in the client database table. This data is transferred to the client during the sync process. This can cause long initialize and sync times when binary attributes are used. Instead consider using the Media Library or DocMan where the data is transferred separately to the transaction sync process.
Failed Transactions¶
Failed transactions happen when the client does not apply the same validation checks as the server. Failed transactions stop any following updates from being processed by the server. Fixing failed transactions can leave the client data in an inconsistent state. Reducing failed transactions is important. See the Mobile App Procedures documentation for more information.
Transaction Groups¶
Entity updates and actions can be placed within a transaction group. When a failed transaction happens, further updates within the same transaction group will stop being processed. Updates within a different transaction groups will continue to process.
entity WorkOrder {
transactiongroup = "WorkOrder: ${WoNo}";
}
entity WorkOrderTimeReport {
transactiongroup = "WorkOrder: ${WoNo}";
}
action MyAction Text {
transactiongroup = " WorkOrder: ${WoNo}";
parameter WoNo Text;
}
With the above client definition, updates to one work order will not stop updates being processed for another work order.
Functions and Actions¶
Offline actions are asynchronous, and functions are client side only. Any client definitions depending on the results of an action or function must have a client-side procedure written to provide the result and do any local side effects.
For example: Doings a status change may take a while to complete if the user has no internet connection. In this situation, the client database needs to be updated with the new status before the server completes the action. See the Mobile App Procedures documentation for more information.
Server Generated Primary Keys¶
The client generates a negative number for the server generated key columns. The client key will not match the server key until the user initializes. References must be properly defined against the entity, so the server can recognise foreign keys and link entity updates to the correct records.