How to add an image to a report from sys_file table ?

Hi,
I want to add an image to my report. Actually my report belongs to a person which contains all person details. Along with all the details i want to add an image of the same person.
All images are in sys_file table. How to do that ?

What to do in the template and how i will fetch the image from table.

Hi
To adjust a report to display images from sys$FileDescriptor do the following:

  1. Add a field for picture to the report template.
  2. Add the corresponding field to the report structure.
  3. Specify the format of the field:
    Open Parameters and Formats tab of the report editor and create a new Value format.
    Input the name of your field (in the “Band.Field” -format) and select the “${imageFileId:WxH}” as format string. Change “W” and “H” to the values you need (see the attached screenshot).
  4. In the report structure adjust the query for corresponding data set: ID of the file should be passed to the field created above.
  5. Print the report.

For more information see the following documentation:
https://github.com/cuba-platform/yarg/wiki/Formatters#inlining-images
https://doc.cuba-platform.com/reporting-6.2/formatters.html
The topic could also be useful:
https://www.cuba-platform.com/discuss/t/add-image-to-word-template-from-entity

PictureBand

Hi,
Thank u for your reply.
But in my case its not working. May be i am not doing in the proper way. I am attaching three screen shots. Can you please check and let me know where i am doing wrong so that i am not getting the image in the report.

img1

img2

img3

Hi Rostislav,

We are using cuba file descriptor to store the image for a person. I followed the first step in https://www.cuba-platform.com/discuss/t/add-image-to-word-template-from-entity show the image in report. Still it is not coming in the report and one exception is coming. I am attaching the screenshots here. Please let me know where I am missing.

Thanks,
Bismay

error

format

report template

Hi
Which query do you use for the dataset?
UUID should have format like “5b72bec8-bcfb-11e4-895d-f08bbfd65a18”

Below is the query i have written for image id.


SELECT demo_sem1.sem_person.image_file_id as personimage
from demo_sem1.sem_person
inner join demo_sem1.sem_case_header on demo_sem1.sem_person.id = demo_sem1.sem_case_header.person_id
where sem_case_header.id=${caseId}

and i am getting the id as "d130?8a6e93c6b4a9bc2500b8f9e164"
The type of id in sys_file table is varchar(32) not UUID.

Are you using MySQL database?
The “Id” field on MySQL(and Oracle) has Varchar(32) format. The reporting system considers it incorrect.
It is an issue. We will fix it.

As a workaround transform your query to JPQL.
Report with the following query works well in my project.


select e.name as name,  e.photo.id as picture from reportwithimages$Person e

Hi Rostislav,

is there any specific syntax to get image in a report ?

I am using

 ${Person_Image. image}

in my template.
and you can find my band details for image from the attachment i have attached.

Can u please take a look and let me know where i am doing wrong. and why the image is not getting displayed in my report. ?

band

Hi…
Its working now. Thank u.

Hi.

The issue with SQL queries is fixed in the platform version 6.3.0.