Skip to Content
1
May 22, 2020 at 12:46 PM

Display images of variable type in fiori app

943 Views

Hi all,

I am building an app that includes displaying locally stored png images as described in

https://cap.cloud.sap/docs/guides/providing-services in the section serving/streaming media data and would like to allow to display images of any image type.

Changing the elements of an entity 'People' from:

entity
People: cuid {
...
image: LargeBinary @Core.MediaType: 'image/png';
}

to

entity
People: cuid {
...
image: LargeBinary @Core.MediaType: imageType;
imageType : String @Core.IsMediaType: true;
}

allows to put and get images for each person, but the image is no longer displayed in the fiori app.

I defined some test data in a people.csv file:

ID;...;imageType
1ccf5a1d-406e-4639-a0bb-b485356e0bd1;...;image/png
6c41ec93-c301-40ae-9893-9aaaa322298d;...;image/png

and used png files and put operations to set the content of the image element for the instances of the people entities.

In the fiori app I display the image as a LineItem DataField by the following lines contained in the app/fiori-service.cds file:

{$Type: 'UI.DataField', Value : image}

and the annotation:

image@( UI.IsImage: true)

Does somebody know how images of a variable type can be displayed in the fiori app?

Cheers,

Lea