Files

To access files from file fields in data sets via an OData service, the corresponding file field must be added to the service. Since Intrexx provides additional metadata fields for file fields, a field with the complex data type "IxFile" is automatically added to the entity type for each file field. In addition to the file itself, this also contains metadata, such as the file name, type, and size. In addition, there are three functions available for accessing and managing files. There are two ways to access files, which are explained below.

Embedding Files in OData Feeds

The first option is to embed file content directly as a Base64-encoded binary string in an OData feed or entry. This is the simplest way to access a file, as it is included directly in the results of an OData query. The OData connector can extract the file contents and save them locally as a file, transfer them to another file field in a target file group, or display the file in the browser using the file selection control. It is also possible to save and update individual files using the file selection dialog. The disadvantage of this approach is that only one file can be provided per file field. In the case of multiple-file fields, this is always the first file, and a new file is always added when saving. In addition, the service's performance is significantly impaired because the file must first be loaded entirely into main memory in order to be encoded or decoded there. Therefore, this method should only be used for smaller files.

OData Functions for Files

The upFile functions, which are automatically available in every Intrexx OData service, offer a much more flexible and resource-efficient way to access files via OData. These functions allow you to save and retrieve files. In addition, Intrexx offers full support for multi-file fields. The only drawback is that Intrexx's file controls do not support this approach, which is why downloading or uploading files in Intrexx web applications must be implemented on a project-by-project basis using JavaScript or Groovy. An Intrexx OData service for managing files offers the following features.

  • upFileList

    The upFileList function returns

    a list of all files in a file field. The following parameters are expected:

    1. recId: The primary key of the record containing the file field.

    2. fieldGuid: The field GUID of the file field.

  • upFileAction

    These functions can be used to perform operations on multi-file fields

    . The following parameters are expected:

    1. recId: The primary key of the record containing the file field.

    2. fileId: The file ID.

    3. fieldGuid: The field GUID of the file field.

    4. Operation: The file operation to be performed (either delete, moveUp, moveDown, moveTop, refreshMetadata, or refreshOrder).

  • upFileDownload

    Returns the contents of a file as a Base64-encoded string.

    The following parameters are expected:

    1. recId: The primary key of the record containing the file field.

    2. fileId: The file ID.

    3. fieldGuid: The field GUID of the file field.

  • upFileResource – upload

    Enables a stream-based upload of a file.

    This is the fastest and most resource-efficient way to transfer files to the service. The following parameters are expected for the uploadFile method:

    1. recId: The primary key of the record containing the file field.

    2. fieldGuid: The field GUID of the file field.

    3. fileName: The file name.

    4. contentType: The content type of the file.

  • upFileResource - download

    Enables a stream-based download of a file.

    This is the fastest and most resource-efficient way to access files. The following parameters are expected for the downloadFile method:

    1. recId: The primary key of the record containing the file field.

    2. fileId: The file ID.

    3. fieldGuid: The field GUID of the file field.

    4. disposition (optional): The Content-Disposition header type (either "inline" or "attachment").

More Information

General Information

System Requirements

Consume data

Provide Data

Integration into Applications

Use in Processes

Expert Settings

Appendix