Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Daniel77
Creator
Creator

add a url to an if match statement in Straight table

Hi Experts,

 

I would like to add an if match statement to a straight table with returns an image from the QMC.

 

I tried like this in the image label fields:

 

=if(match(ICONS,'wtovU'),'https://linktomyiamage in QMC.

I have tried the add url option and see the image against all values in the table. I need to specify a code to show the correct image. Is this possible.

I have looked for Link / URL functions but there seems to be nothing. Help would be greatly appreciated. Thank you

 

Daniel

Labels (1)
1 Solution

Accepted Solutions
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @Daniel77 

So, you can get a single image to show in every row in that column, but the issue is getting it to pick?

The code you have posted has a bug, in that there is an unclosed single quote - so be careful of that.

Expressions in tables should all have aggregations, otherwise a mix of things will cause problems. If ICONS is a dimension you should be fine, but just in case a max or maxstring is a good idea. So:

=if(match(maxstring(ICONS),'12345'), 'https://contentlib/image.jpg', '')

If you only have one icon to match you can do a simple if:

=if(maxstring(ICONS) = '12345', 'https://contentlib/image.jpg', '')

The joy of match comes in when you pair it with a pick statement:

=pick(match(maxstring(ICONS), '12345', '67890'), 'https://contentlib/image1.jpg', 'https://contentlib/image2.jpg')

What I would look to do though, if you have the ability to change it, is to have the ICON code in the filename, this then becomes super-simple and extensible:

='https://contentlib/icon' & maxstring(ICONS) & '.jpg'

Hope those thoughts move you forward a bit. Watch out for case sensitivity and the like. It's always worth testing URL expressions by adding a measure column and just showing the URL as text, that way you can debug why your image is not showing.

Steve

View solution in original post

10 Replies
TcnCunha_M
Creator II
Creator II

I fair as i know this is not possible in QMC, you can do it in the Application

 

As you think, so shall you become.
Daniel77
Creator
Creator
Author

Thank you, when you say possible in application, you mean you can link an image to show based on if match? do you know where i can find instruction for this?

Thank you

 

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

A really simple way to do this is to use emojis, that you can just copy and paste into your code.

=if(sum(Sales) > sum(Target), '😀', '☹️')

It does kind of rely on you finding emojis that fit though.

Not sure about using images from QMC.

Steve

henrikalmen
Specialist
Specialist

I have read your question, and the answers posted so far, and I'm not sure what your actual question is. Are you asking what the address is to images uploaded in the QMC's content library management? In that case the answer to your question may be 'https://qlik.serveraddre.ss/content/CONTENTLIBRARYNAME/theimage.gif' 
Naturally, you need to replace the server address and the name of the content library (and the image name) in this example to values that match your environment.

Daniel77
Creator
Creator
Author

Nice,

Unfortunately i need to display wash symbols which i don't think are in the emoji family.

Appreciate the thought though 🙂

 

Daniel

Daniel77
Creator
Creator
Author

Hi,

Sorry if i have not explained myself, appreciate your efforts to help.

Let me explain in full. We have a code 12345 for example. each of those numbers refers to a wash symbol, this is an internal font which we cannot share, the customer does not want to see 12345, so i want to make an image of each of the combinations. and say if the code matches 12345, show this image which i have saved in the qmc content library. I am aware how to get the link of the image.

I can show the whole column as an image by using the image representation, i can use the link and have a link to the images, it just seems odd i cannot add a link in the result of an if statement like i showed here:

=if(match(ICONS,'12345'),'https://linktomyiamage)

 

I thought there may be a function like RGB(132.365.656). like maybe Link('https://linktomyiamage)

 

Do you know if there is a way to achieve my requirement ?

Thanks again for your time in reading and trying to assist. 

Daniel

henrikalmen
Specialist
Specialist

What result are you getting, and what result would you like? You say that you "cannot add a link" but what does "can not" mean in your situation? What problem occurs?

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @Daniel77 

So, you can get a single image to show in every row in that column, but the issue is getting it to pick?

The code you have posted has a bug, in that there is an unclosed single quote - so be careful of that.

Expressions in tables should all have aggregations, otherwise a mix of things will cause problems. If ICONS is a dimension you should be fine, but just in case a max or maxstring is a good idea. So:

=if(match(maxstring(ICONS),'12345'), 'https://contentlib/image.jpg', '')

If you only have one icon to match you can do a simple if:

=if(maxstring(ICONS) = '12345', 'https://contentlib/image.jpg', '')

The joy of match comes in when you pair it with a pick statement:

=pick(match(maxstring(ICONS), '12345', '67890'), 'https://contentlib/image1.jpg', 'https://contentlib/image2.jpg')

What I would look to do though, if you have the ability to change it, is to have the ICON code in the filename, this then becomes super-simple and extensible:

='https://contentlib/icon' & maxstring(ICONS) & '.jpg'

Hope those thoughts move you forward a bit. Watch out for case sensitivity and the like. It's always worth testing URL expressions by adding a measure column and just showing the URL as text, that way you can debug why your image is not showing.

Steve

Daniel77
Creator
Creator
Author

Hi,

When i place the link in the browser which i refer to in the if statement, i see the QMC content library image:

Daniel77_0-1709135226814.png

So i know this is working, but in the cell where there is a match is only see the link and not the image in the link:

Daniel77_1-1709135309377.png

 I wanted to show the image here, no the link to the image. This is the issue.

Thanks again

Daniel