How to add an image to a representation class
This ‘How to’ provides information on how to add a BLOB (image) to a representation class. Managing images is very simple in Version 7. Supervisor management can be used to manage images or they can be managed using your own code. The following development process describes how Supervisor management can be applied to manage images without the need to write a script code.
The development process for the key element or entity to which image management is required must have been completed. For example, the data table, data class, and representation class must have been defined, and the class representation made visible in the client.
As a rule, images should be stored in their own data table, separate from the main data. This practice particularly helps with the use of disk space.
Using the Tables option (Development > Data and Parameters > Tables > Tables), create a new Data table (MYTABLE1) for storing images. The following property (field) details are required:
The key field must be linked to the main data table (field Linked table).
A field specifically for an image must be added. The data type (field Type) for this field must be set to ABIMG.
Data type 'ABIMG' is a predefined data type for managing images. It is defined with Supervisor management, for example, the data type is set for media files (fields Internal type on the General tab and Type on the Class tab) with Supervisor management (field Supervisor mgmt on the Class tab is set to Yes).
A field specifically for a document type must be added. The data type for this field must be set to ATYP.
Data type 'ATYP' is a predefined simple data type for documents used by supervisors.
Save and validate your data table.
The property defined in the data table for the image must now be added to the data class.
Open your existing key entity data class. Add the image field, as follows:
Type: This must be set to ABIMG (see Data tables above).
Table of the lob: This must be set to the Data table name defined for your images (MYTABLE1).
Lob field: This must be set to the field defined in the Data table specifically for the image.
Value: This must be set to the key field in the main data table. For example, the data table for the key entity.
Note: You will not be able to validate until the table key has been entered.
Save and validate your data class.
The property defined in the data class for the image must now be added to the representation class.
Open your existing key entity representation class. Add the image field as follows:
To add the image field to a new block, add an identifiable Code and Section.
Note: This step is not required if the image field will be added to an existing block.
Property: Add the code for the image defined for the Data class.
Block: Add the block the image is to be managed in.
Select the Detail, Edit, and Enterable check boxes.
Save and validate your representation class.
The Menu item for the representation class will contain an area in which images can be managed (added or deleted). This area will either be in a new block or an existing block, depending on how the representation class was defined.