Official Content

The Offline Database object's Conditions are used to define the filters that will be applied to the data before synchronizing with the devices.

Conditions are applied to the Extended Table in order to guarantee the data consistency in the Offline Database. This is because each condition is independent and GeneXus has the intelligence to determine in which tables the filters need to be applied. The criterion of this is: if the condition is evaluable in the extended table of some table, then the filter will be applied. This allows you to do not to worry about the referential integrity of the data that will be stored in the device.

For example, by writing the following condition:

CustomerStatus = CustomerStatus.Active;

...will filter the Customers table by active customers, but will also filter the PurchasesOrders table (where the Customer is a foreign key) to allow only purchase orders from active customers. By doing this, there won't be PurchaseOrders in the device's database without a corresponding Customer.

In the Offline Database Object Navigation Report it is shown how the conditions are applied for each table that is going to be synchronized to the device.


Total filtering (no records in a specific table in the device)

In some cases, you may need to have a table in the local database because the application saves data to that table, but you don't want to bring any record from the server.
In that case, one possible solution is to define a condition that will never evaluate to True.
For example, if you don't want to receive any Purchase Order in the device, the following condition could be used:

PurchaseOrderID < 0;


Notice that the conditions are only applied for the synchronization process and not for the offline database itself.
The developer is in charge of handling the local data created on the devices when they are not considered for syncrhonization..

See also

Last update: November 2023 | © GeneXus. All rights reserved. GeneXus Powered by Globant