How to implement dynamic picture in mappReport?

Hi,

I want in my report that a picture should be dynamic depending on a variable.

For example a checkmark picture if the value is 1 for a PLC variable.

Have anyone been able to get that to work or know a workaround?

It is around 30 different values I want to show in the report with some kind of graphical representation.

2 Likes

I understand what you mean, but I do not think that this is possible. At least I do not see any alternative for how to configure it in mappReport. As far as I can see, the picture must be stored in the user partition and you refer directly to the picture name in the report. Maybe someone else from B&R Community can either confirm my thinking or provide different idea? @bengtssond , if you do not get answer here in upcomming days, please get in contact with local support.

1 Like

One of my colleagues implemented something like this using pictures from a Vision camera.

You will have to make sure to convert the image to the correct jpeg encoding format, so that it is valid in a PDF.

He will be back from vacation in 2 weeks afaik, so if it isn’t solved by then, I will forward this to him and he can for sure give some insights there.
Pinging him for now:
@ferronia

1 Like

Hello,
I asked a support colleague a few months ago, and here is the workaround he proposed to me (since it is not possible to do it via MpReport configuration at the moment):

…..

But what you can maybe try as the workaround — you could have 3 images on the file device (good.jpg, bad.jpg, current-status.jpg; or similarly named).
You could then use the standard FileIO functionality (or MpFileManagerUI) to “copy” the status image (e.g., “good.jpg”) to the “current-status.jpg”.
In the MpReport configuration you would then only need to set the image to “current-status.jpg”, and the application logic itself can decide what this image will look like (maybe in future there’s a third option?).

Pseudo-Code / example (not tested, not compiled, no error handling, no state-management, …):

The idea is basically to overwrite an image before generating the report.
Hopefully this can help you.

Best regards,
Rémi

2 Likes

Hi,

Thanks for the input!

This workaround was the only way I could get to work when I did a POC. But was hoping for a nicer solution :slight_smile:

The pseudo-code for my solution, that maybe can help someone else.
I first created an action that defined the value, picture name and parameter type:

After that I looped the array and for every parameter I did the fileCopy as suggested.