[Today’s post is just a little trick – not that hard to work out. But I liked it, and it’s my blog, so I’m writing about it. Also, after all the efficient workbook and densification stuff I could use the break.]
I’ve recently been working on some dashboards that run against the Tableau Server audit tables so I can see what my troublesome colleagues are up to on my demo server. One of the views I created was a timeline showing what is being done:
I wanted the tooltip to show the name of the object that was being accessed/created/deleted/modified, but the name is in a different field depending on the object type – e.g. workbook, view, data source, data connection, etc. And only one or two of those fields would be valid for any event record. Additionally, some events require a concatenation of the names – e.g. if I’m accessing a view I want to also know the name of the workbook that it comes from:
Simply concatenating the fields together doesn’t work as some of the values will always be NULL, and any computation against a NULL results in a NULL. So we dutifully pull out the IFNULL() function and get to work:
ifnull([DC-Name], "") + ";" + ifnull([DS-Name], "") + ";" + ifnull([WB-Name], "") + ";" + ifnull([VW-Name], "")
The problem with this is, if we look at a data connection the label shows:
Exasol 1GB TPC H;;;
Or a view shows:
;;Server Audit Data; Event Timeline;
So – combining our previous finding (computation with NULL returns NULL) we can modify our calculation to be:
ifnull([DC-Name] + "; ", "") + ifnull([DS-Name] + "; ", "") + ifnull([WB-Name] + "; ", "") + ifnull([VW-Name], "")
And voila! We have what we want.
Enjoy!