Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
124rooski
Partner - Creator
Partner - Creator

Mixing HTML and If Statements within an expression on Gantt Chart

Hi all,

What I am trying to accomplish is very simple but finding it a bit more complex than I'd expected.

Currently, the vizlib Gantt Chart I am using has a section to show a custom tool tip so when a user hovers over a specific data element on the Gantt it'll display elements like: Name, Registered Date, and Unsubscribed Date.

My issue is that I want to throw an if statement within my expression so that if there is no Unsubscribed Date, then go ahead and leave that out completely from the tool tip. All data rows will have a Registered Date but not necessarily an Unsubscribed Date. Here is the syntax that I am currently using.

='Name: '& [Name]
& '</br> ' &
'Registered Date: '& [Registered Date]
& '</br> ' &
'Unsubscribed Date: ' & [Unsubscribed Date]

Now, depending on the data row for a specific customer, I'd only want to display the [Unsubscribed Date] if it is available, and leave it out if there is no value. Here is what I tried.

'Name: '& [Name]
& '</br> ' &
'Registered Date: '& [Registered Date]
& '</br> ' &
if(IsNull( [Unsubscribed Date], ' ', 'Unsubscribed Date: ' & [Unsubscribed Date])    

also..

if(len( [Unsubscribed Date] > 0, null), 'Unsubscribed Date: ' & [Unsubscribed Date])

I have a feeling intertwining the HTML codes within the expression is off and was hoping someone can point to the right place. Much appreciated everyone.

 

Labels (3)
1 Reply
124rooski
Partner - Creator
Partner - Creator
Author

For anyone wondering for a solution above:

if(isNull([Unsubscribed Date]), '','Unsubscribed Date: ' & [Unsubscribed Date]) is working fine.

The only issue now is that it is creating a line break (I do have other labels/tooltips underneath this one). But the syntax is working.