Vlog: Sisense BloX Explained part 2
Hi, welcome back to the Corona Learning Series. I’m Diego Cordero, and I’m the BI Lead and Data Strategist at Profusion. Today we’ll be looking at Sisense BloXs, and specifically how to create custom actions.
With BloXs actions, you can add buttons that open the URL, create dashboard filters and actually, you could create custom filters, you can create and build a button that jumps to another dashboard, you can submit forms and you can create custom actions, which is what we’ll be looking at today. So, let’s jump to the demo.
On this demo dashboard, we show all the pubs in the UK, we can see the total number of pubs is 51,566, we can see average number of pubs per local authority and the average rating and it’s important to say that these ratings are fake, it’s just a random number. So don’t use this to guide your pub choice for tonight. We can see how a map with a density for location so, you can see that London, Birmingham and Leeds, Manchester have tonnes of pubs. And some other places have less pubs. You can see the number of pubs per local authority. You can see the pubs per person in each of the local authorities in City of London as there are lots of pubs per person.
On this widget, I’ve implemented the jump to dashboard feature which is an official Sisense add on and it allows you to add a sub dashboard to your dashboard. So let’s jump for example into Brighton and click jump to drill. On this dashboard here we can see that Brighton and Hove has been filtered out because of its average rating the number of total pubs. And here we have a slider with a ranking for every pub in Brighton. Now this one is Brighton & Hove Golf Club Bar, it doesn’t sound like a pub. But it’s turned out to be number one in our randomiser. As you can see, we have the slider with different pubs. Now, what we want to do is add a new button, that will jump to Google Maps and show you the way to get there. So here on our drill dashboard, we’re going to go and edit our BloXs widget, where we’re going to add the action, and we’re going to add it here but first we need to create the action. As you remember from the last video, here we have the snippets for the different kinds of actions. But what we need is a custom one so can go and create new action.
You can see here we have a sample code comment above that tells you what you need to get. In this case, you need to get the payload object. So, if we print that object, we can add it here as a test button. Okay, copy that and create and we add that here. We will see, by clicking it will get a payload object. And you can see that here we have our results object. And then all the list inside results matches the names that we have here. So you can add whatever text you need from there are value which in this case will be the same that way, we can create an action that gets the bad object and create whatever action we want. So let’s create an interesting one, which is the Google Maps button. So we can create. We’ll get rid of that and we’re going to get const, pub equals payload, then result, as we see it saw the object. And then we can get the name and then text. And then we have the address equals payload, resolve, address, and text. Perfect.
Now we need to create a URL, that’s constant URL, equals and here I have a URL that we need. Which is the Google Maps URL with a coordinates for the office, and then we add the pub. And then we add a space and then we add the address. And well, the last bit is just window.open. Open the URL, URL as a parameter. And we named that as Google Maps. Next, and we have our button, create. And then we can replace our test button. With the Google Maps on any subtitle we can go right go now. And let’s apply to test that. Let’s go to The Eagle which sounds more like a pub, go now and as you can see, here we have the instructions to go from the office to the pub in Brighton and probably those pints are worth it.
So that is it for today. Thank you so much.
If you need help with Siense BloXs, get in touch with us on firstname.lastname@example.org.