# OfflineDataDescription

## Overview

The `OfflineDataDescription` class facilitates the creation of offline description packages, enabling mobile clients to operate without an active connection. This class provides methods to expose foundsets and their related data to mobile clients, ensuring the necessary data is available offline.

The `addFoundSet(fs)` method exposes a foundset to the mobile client. If a mobile shared module is present, all possible relations from that module are automatically traversed. Alternatively, the `addFoundSet(fs, relationNamesToTraverse)` method allows developers to specify which relations to traverse, overriding automatic traversal.

## Methods Summarized

| Type | Name                                                                                | Summary                                             |
| ---- | ----------------------------------------------------------------------------------- | --------------------------------------------------- |
| void | [addFoundSet(fs)](#addfoundset-fs)                                                  | Exposes an unrelated foundset to the mobile client. |
| void | [addFoundSet(fs, relationNamesToTraverse)](#addfoundset-fs-relationnamestotraverse) | Exposes an unrelated foundset to the mobile client. |

## Methods Detailed

### addFoundSet(fs)

Exposes an unrelated foundset to the mobile client. If service solution has a module of type Mobile shared module all possible relations from that module are traversed automatically.

**Parameters**

* [JSFoundSet](https://docs.servoy.com/reference/servoycore/dev-api/database-manager/jsfoundset) **fs** the foundset

**Returns:** void

**Sample**

```js
var retval = plugins.mobileservice.createOfflineDataDescription('data_');
var ff = databaseManager.getFoundSet('bug_db','mytable');
ff.loadAllRecords();
retval.addFoundSet(ff);
```

### addFoundSet(fs, relationNamesToTraverse)

Exposes an unrelated foundset to the mobile client.\
which can be used in the mobile client in an unrelated way like in a (first) form or databaseManager.getFoundset(...).\
For each record in the provided (unrelated) foundset the specified relation names are traversed and all data taken. Providing the relation names to traverse overrides the automatic traversal of the relations found in the "Mobile Shared Module".

**Parameters**

* [JSFoundSet](https://docs.servoy.com/reference/servoycore/dev-api/database-manager/jsfoundset) **fs** the root foundset
* [Array](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/array) **relationNamesToTraverse** the relations to traverse from records found in root root foundset

**Returns:** void

**Sample**

```js
var data = plugins.mobileservice.createOfflineDataDescription('data_');
var fs_contact = globals.accountmanager_contacts; //contains the account manager contact
var traverse = new Array();
traverse.push('accountmanager_to_companies');
data.addFoundSet(fs_contact, traverse);
```

***
