Files

Files In order to enable access from an OData service to files from file fields in data groups, the service must have the corresponding file field added to it as described previously. 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, this also contains metadata, such as the file name, type, and size. Furthermore, three functions are available to access files and manage them. There are two possibilities to access files, which are described in the following.

Embedding files in OData feeds

The first possibility is to directly embed a file's contents as a base-64 encoded binary sting in an OData feed or entry. This is the simplest method to access a file, by providing it directly with the result of an OData request. The Connector for OData is able to extract the file's contents and save it locally as a file, and/or transfer it to another file field in a target file group and show the file in the browser using the Intrexx file control. It is also possible to save or update individual files using the file control. The disadvantage of this approach is that only one file can be provided for each file field. In the case of multiple file fields, this is always the first file, though a new file will always be added when saving. Also, the performance of the service will be significantly negatively impacted, since the file must first be completely loaded into the RAM in order to encode or decode it. For this reason, this method should only be used for smaller files.

OData functions for files

A significantly more flexible and resource-saving possibility to access files using OData is by using the "upFile" functions, which are automatically available in every Intrexx OData service. They can be used to save and request files, and They provide full support for multiple file fields in Intrexx. The single disadvantage of the functions is that the file controls in Intrexx do not support this approach, which means that uploading and downloading files in Intrexx web applications will need to be realized on a project-specific basis with JavaScript or Groovy. The Intrexx OData service offers the following functions to manage files:

  • upFileList

    The upFileList function returns

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

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

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

  • upFileAction

    These functions can be used to perform operations on multiple file fields.

    The following parameters are expected:

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

    2. fileId: The ID of the file.

    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 base-64 encoded string.

    The following parameters are expected:

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

    2. fileId: The ID of the file.

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

  • upFileResource upload

    Enables the stream-based upload of a file.

    This is the fastest and most resource-saving method to transfer files to the service. The "uploadFile" method expects the following parameters:

    1. recId: The primary key of the data 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 the stream-based download of a file.

    This is the fastest and most resource-saving method to access files. The "downloadFile" method expects the following parameters:

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

    2. fileId: The ID of the file.

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

    4. disposition (optional): The content disposition header type (either inline or attachment).

More information

General

System requirements

Consume data

Provide data

Integration in applications

Use in Processes

Expert settings

Appendix