Adding an Image to a Representation Class

This document provides information on how to add a BLOB (image) to a representation class. You can manage images using Supervisor management or your own code. The development process described below shows how you can use Supervisor management to manage images without writing a script.

Prerequisites

Make sure you have finished your development for the key element or entity requiring image management. For example, the data table, data class, and representation class must have been defined, and the class representation must be visible in the client.

Creating the data table

As a rule, images should be stored in their own data table, separate from the main data. This is particularly helpful to reduce disk space use.

  1. Create a new data table (MYTABLE1) in Development > Data and Parameters > Tables.
  2. Go to the Columns tab and link the key field to the main data table in the Linked table field.
  3. Add a specific field for images with the "ABIMG" data type.
    "ABIMG" is a predefined data type used to manage images. It is defined with Supervisor management.
  4. Add a specific field for simple document types with the "ATYP" data type.
    "ATYP" is a predefined data type for documents used by supervisors.
  5. Save and validate your data table.

Updating the data class

You now have to add the property defined in the data table to the data class.

  1. Open your key entity data class.
  2. In the Properties block of the Properties tab:
    1. Add a code for the image in the Property field.
    2. Set Type to "ABIMG".
    3. Set Lob table to the data table name defined for your images (MYTABLE1).
    4. Set Lob field to the field defined specifically for images in the data table.
  3. In the Keys block, set Value to the key field in the main data table.
    Note: This step is mandatory.
  4. Save and validate your data class.

Updating the representation class

You now have to add the property defined in the data class to the representation class.

  1. Open your key entity representation class.
  2. In the Blocks block of the Organization tab, add a code and a section for your image field.
    Note: This step is not required if the image field is added to an existing block.
  3. In the Displayed Properties tab:
    1. Add a code for the image in the Property field.
    2. Add the block where the image has to be managed in the Block field.
    3. Set Detail, Edit, and Enterable to "Yes".
  4. Save and validate your representation class.

The menu item for the representation class now contains an area to manage images, either in a new block or in an existing block, depending on how the representation class was defined.