Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I need to display different images based on the value of a variable. Unfortunately, the native "Text & Image" object doesn’t seem to meet my requirements.
Is there a way to load images from the media library depending on a variable (the variable will likely match the image names with a ".png" extension)?
I’ve come across extensions that allow the use of APIs or URLs, but my images are stored on my PC, and I'm not sure how I can share them via URLs (security policies).
Does anyone know of an extension that can help with this?
Thanks in advance for your help!
Maybe I misunderstood your needs, anyway I was thinking about something like this.
In the data model you define a table containing the image path (sense content library), similar to this:
images:
LOAD * Inline [
name, url
MAN1, /content/lab/noun-man-7038300.png
MAN2, /content/lab/noun-man-7038323.png
MAN3, /content/lab/noun-man-7038334.png
]
and display it in a straight table
If you need only one image, you can define a variable that retrieve the url image by a criteria:
for example vCurrentUserImage:
=IF(subfield(OSUser(), '=', -1) = 'cristian.dalsanto', '/content/lab/noun-man-7038300.png', subfield(OSUser(), '\', 2))
and showing it using the table:
best regards,
Cristian
Thank you @cristian_dalsanto for your precious suggestions, they were really helpful.
Her is the solution we used:
All the images has been loaded into the Media Library,
Through the api
https://tenant.region.qlikcloud.com/api/v1/apps/appId/media/list
we got the URLs of every image (see https://community.qlik.com/t5/Move-to-SaaS/Is-there-a-way-to-share-the-Media-Library/td-p/2456608).
Using the "Map" object, with
So we got a single image, based on a variable. No extension needed (even if it's a pretty strange procedure if you ask me, both the map object and the API to retrieve the images URLs)
We didn't use the map because, to show only one image at time, it wasn't aesthetically pleasing.
Hi @Pico ,
maybe you've already thought of this, but you could upload the images to the Qlik Sense content library and then display them with an extension or the native Sense table object.
regards,
Cristian
Note that I need one single object, cause I have 40+ images, so loading 40+ different objects (like "text & image" one) and using a visualization condition on all of them, it's not feasible!
Thank you very much
Edit: I'm assuming "Qlik Sense content library " and Media Library to be the same thing. If 'm wrong please tell me
Maybe I misunderstood your needs, anyway I was thinking about something like this.
In the data model you define a table containing the image path (sense content library), similar to this:
images:
LOAD * Inline [
name, url
MAN1, /content/lab/noun-man-7038300.png
MAN2, /content/lab/noun-man-7038323.png
MAN3, /content/lab/noun-man-7038334.png
]
and display it in a straight table
If you need only one image, you can define a variable that retrieve the url image by a criteria:
for example vCurrentUserImage:
=IF(subfield(OSUser(), '=', -1) = 'cristian.dalsanto', '/content/lab/noun-man-7038300.png', subfield(OSUser(), '\', 2))
and showing it using the table:
best regards,
Cristian
Thank you @cristian_dalsanto for your precious suggestions, they were really helpful.
Her is the solution we used:
All the images has been loaded into the Media Library,
Through the api
https://tenant.region.qlikcloud.com/api/v1/apps/appId/media/list
we got the URLs of every image (see https://community.qlik.com/t5/Move-to-SaaS/Is-there-a-way-to-share-the-Media-Library/td-p/2456608).
Using the "Map" object, with
So we got a single image, based on a variable. No extension needed (even if it's a pretty strange procedure if you ask me, both the map object and the API to retrieve the images URLs)
We didn't use the map because, to show only one image at time, it wasn't aesthetically pleasing.