Skip to content

FileLink

fileLink links files to a record. The file itself is never part of the record, it is always retrieved from the server via a URL. The configuration is used for two different purposes:

Purpose Typical properties Section
Attach a file to a record url, fileName Documents, e.g. a DOCLINKS meta record
Show a thumbnail url, on, existsAttribute Business records with an image, e.g. an item/asset

Additionally, files can be stored offline with the download option. Read the risks before using it.

Use fileLink on a document meta record (for example DOCLINKS) to assign the file to the record. The meta record contains the information needed to build the URL and the file name. The file is opened, viewed or edited using this configuration.

"root": {
    "fileLink": {
        "url": "insight/document/${DOCLINKSID}",
        "fileName": "${filename}"
    }
}
  • url: URL to retrieve the file from the server. Variables of the record can be used, see variables/values.
  • fileName: To store the file with a correct file name. This property is optional and only must be set if the url does not contain a file name with extension.

More information about documents: Documents.

Thumbnail

A thumbnail assigns a small image to a business record. It is shown in the root list, child list and search results and optionally in the popup of a record on the map.

"root": {
    "fileLink": {
        "url": "insight/document/insight/${identifier}",
        "on": ["list", "map"],
        "existsAttribute": "identifier"
    }
}
  • url: URL to retrieve the image from the server. Use an image quality suitable for thumbnails, see Image quality.
  • on: List of views in which the image is shown: list (root list, child list and search results) and map (popup of a record on the map). If not set, no image is shown. on replaces the former property showInList.
  • existsAttribute: Optional attribute which defines if an image exists. If the value of the attribute is undefined, null, 0 or an empty string, no request is sent and the placeholder is shown. If not set, the image is always requested.
Avoid unnecessary requests

Always set existsAttribute if not every record has an image. Otherwise the client requests an image for every visible list item, which fails for records without an image.

Style

To change the default style of the image, the following classes can be used:

  • item-image on the list item when it has an image. This class is also set when the existsAttribute returns false.
  • item-image-placeholder on the placeholder image which is shown while the image is loading or no image exists.
  • item-with-image on the content of the item having a loaded image. To align the content next to the image.
.item-image {
    position: var(--list-image-position);
    left: var(--list-image-left);
    height: var(--list-image-height);
    width: var(--list-image-width);
    object-fit: var(--list-image-object-fit);
}

.item-image-placeholder {
    opacity: var(--list-image-placeholder-opacity);
    display: var(--list-image-placeholder-display);
    justify-content: var(--list-image-placeholder-justify-content);
    align-items: var(--list-image-placeholder-align-items);
    font-size: var(--list-image-placeholder-font-size);
    width: var(--list-image-width);
}

.item-with-image {
    padding-left: calc(var(--list-image-width) + 9px) !important;
}

The variables are explained here.

Thumbnail Cache

The thumbnail cache stores thumbnails on the device once they were loaded. When the same thumbnail is needed again (scrolling, searching, reopening a list), it is shown from the cache instead of requesting it from the server again. This saves network traffic, speeds up lists and makes already loaded thumbnails available offline.

  • Only thumbnails which were displayed are cached. They are not downloaded in advance and are independent of the download.
  • The cache size is limited. If the limit is exceeded, the least recently used thumbnails are removed.
  • Cached thumbnails are not updated automatically. If an image changes on the server but the URL stays the same, the old image is still shown. To force a reload, the URL must change, e.g. by adding a change date of the record: insight/thumbnail?REFOBJECT=ITEM&REFOBJECTID=${ITEMID}&IMGLIBID=${imglib/IMGLIBID}.
  • The cache is removed when all local data of the client is removed.

Configuration

The cache is enabled by default and works without any configuration. The defaults can optionally be adjusted, or the cache can be turned off, in the Client Configuration (config.json). All parameters are optional.

  • maxEntries: Maximum number of cached thumbnails. Default: 10000.
  • cleanupInterval: Interval in minutes how often the number of entries is checked. Default: 30.
  • disabled: Set to true to turn the cache off. All thumbnails are then always requested from the server. Default: false.

Example with adjusted values:

{
    "thumbnailCache": {
        "maxEntries": 10000,
        "cleanupInterval": 60
    }
}

Example to turn the cache off:

{
    "thumbnailCache": {
        "disabled": true
    }
}

Download

With download the files of a fileLink are stored on the device when the common download is performed (Download configuration). They are then also available offline.

"root": {
    "fileLink": {
        "url": "insight/document/${DOCLINKSID}",
        "fileName": "${filename}",
        "download": true
    }
}
  • download: Boolean, to download the files when the common download is performed. Default: false.

The maximum file count per config is 100 files. The default value can be overridden in the Client-Configuration.

Risks

Downloading files can produce very large amounts of data

Files are usually much larger than the data records. The download can quickly become the most expensive part of a download.

  • Storage: All files are stored on the device. Many or large files (photos, PDFs, drawings) can fill up the device storage, which can slow down the device or the app and can even prevent further downloads.
  • Network: All files are transferred on every download of new or changed data. This can load the server and the network and is expensive on mobile data connections.
  • Duration: The download takes considerably longer. The user has to wait, and an interrupted connection can lead to incomplete downloads.

Recommendations:

  • Set download only if the files are really needed offline. Thumbnails in lists do not need download, use the thumbnail cache instead.
  • Estimate the data volume: number of records × average file size. Test with realistic data and a realistic network.
  • Reduce the file size on the server, see Image quality.
  • Keep maxDocuments as low as possible. The limit is applied per tree config.