Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
We have a request from a client that we display a map of buildings in our mashup (in our case schools) with pdf reports stored on a (different) web server. When the user clicks a building on the map they should either be directly routed to the pdf report (or opened in a new tab) or provided a clickable link right within the mashup.
We are using the Qlik Sense base map - I want to avoid (at this time) - any other mapping utility. So, the idea of clicking on a bubble on the map, and then get linked to another website probably won't work. Since the map is a Qlik visualization, it will simply select field values associated with the building.
What I was thinking of trying was containing the html for the link within a variable. When you select a building on the map, this variable is populated with the URL in an appropriate html (i.e., an anchor tab). The problem, as I see it, is that from the javascript we don't know when this variable changes, so we don't know when to call Qlik for it's updated value.
Is there anything like a persistent callback function for variables? I.e., when you first call the variable for the value you include a callback function that will be called each time the variable value changes?
(Or any other solution to this problem....)
Thanks,
Jonathan
Boy, maybe it's this forum, maybe it's my question, but has anyone noticed a definitive decline in the # or responses to questions since the UI change? Maybe bring the point system - that was fun at least! (But, here I am, talking to myself)
Anyhow, for posterity's sake, I solved this problem myself by avoiding variables altogether.
I used createCube with the fields of interest (i.e., html links), which triggers a callback anytime a user makes a selection. I then filter through the cube data to find the relevant html links. I then just use some angular to display them.
One hint for anyone using the createCube callback. You need to destroy the cube object when you navigate from the page, else you risk having multiple callbacks and useless callbacks running when you don't want them to.
In an angularjs application I use the $onDestroy hook. Inside the hook, you can do something like the following. I saved the id of the hypercube in a variable called hcubeID (you can get it inside the hypercube callback).
$openApp.destroySessionObject(this.hcubeID).then(reply => {
this.hcubeID = null;
console.log("session object destroyed", reply)
}).catch(e => console.log(e));
Boy, maybe it's this forum, maybe it's my question, but has anyone noticed a definitive decline in the # or responses to questions since the UI change? Maybe bring the point system - that was fun at least! (But, here I am, talking to myself)
Anyhow, for posterity's sake, I solved this problem myself by avoiding variables altogether.
I used createCube with the fields of interest (i.e., html links), which triggers a callback anytime a user makes a selection. I then filter through the cube data to find the relevant html links. I then just use some angular to display them.
One hint for anyone using the createCube callback. You need to destroy the cube object when you navigate from the page, else you risk having multiple callbacks and useless callbacks running when you don't want them to.
In an angularjs application I use the $onDestroy hook. Inside the hook, you can do something like the following. I saved the id of the hypercube in a variable called hcubeID (you can get it inside the hypercube callback).
$openApp.destroySessionObject(this.hcubeID).then(reply => {
this.hcubeID = null;
console.log("session object destroyed", reply)
}).catch(e => console.log(e));