1

I'm using QGIS 2.18.14 and I have currently got a map tip in a shapefile of freehold land titles that looks like this:

enter image description here

Both, the title plan and register for the land title have been referenced to a hyperlink on dropbox.

The attribute table for the shapefile is below: enter image description here

My CSS / HTML for the map tip looks like the following:

<style> 
body {
margin-top:0px!important;
white-space: nowrap!important;
}
h1 { 
color: #00713d; 
font-size: 20px; 
font-family: helvetica; 
text-decoration: underline; 
text-align: center; 

} 
h3 { 
color: black; 
font-size: 14px; 
text-decoration: underline; 
font-family: helvetica; 
text-align: center; 
line-height:0px; 
} 
p { 
color:black; 
font-size: 12px; 
font-family: helvetica; 
text-align: center; 
line-height:0px; 
} 
</style> 

<h1> [% "Title No" %] </h1> 
<h3>Proprietor</h3> <p> [%"Proprietor"%]</p> 
<h3> Area</h3> <p> [%"Ac" || ' Ac'%] </p>
<h3> Title Plan</h3> <p><a href=[% "Title Plan"%]>Click Me</a></p> 
<h3> Register</h3> <p><a href=[% "Register" %]>Click Me</a></p> 

You will notice I have not got a link to the title plan ending '11'. I will be uploading this QGIS project to QGIS Cloud and want to make it as professional looking as possible. How would I go about omitting the row "Title Plan" in the map tip represented below when the entry = 'NULL'?

<h3> Title Plan</h3> <p><a href=[% "Title Plan"%]>Click Me</a></p>
2

You could have a case statement:

<h3> Title Plan</h3> <p>[% case when "Title Plan" is not NULL then '<a href='||"Title Plan"||'>' else '' end case %][% case when "Title Plan" is not NULL then 'Click Me</a>' else 'No title plan available' end case %]</p>

If your data is not actually NULL, and just a blank field, you may have to change it to:

"Title Plan" != ''
  • Looks like the ideal solution to me. I will have to test it tomorrow. Thanks for the contribution. – James B Jul 2 '18 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.