Skip to main content
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Referencing a qlikview object within an extension

Hi All,

I am writing an extension that renders a google vizualization. On the same sheet as my extension, I have two listboxes that display data fields as normal.

From within my javascript I would like to be able to obtain a handle to these listboxes so that I can iterate over their data.

The API documentation says to use: 'Qv.GetCurrentDocument().GetObject(objectName)' where objectName is defined as 'The name of the object you want to append your callbackFn to.'

However, the problem I'm having is that I do not know the name of my objects in order to be able to reference them. I have tried the obvious things like using their objectId etc. but none of these are successful. No matter what I use for the objectName parameter, I don't get back a proper handle to the object:

Example 1

          var mydoc = Qv.GetCurrentDocument();

          var ch    = mydoc.GetObject("LB02");


Example 2

          var mydoc = Qv.GetCurrentDocument();

          var ch    = mydoc.GetObject("Document\LB02");


After running either of the above code samples, I expect to obtain an alert with the ObjectId of my listbox in order to prove I have obtained a correct handle. However, the alert box is always just blank.

Can anybody please advise on how I can find the internal QV name assigned to each object? Or perhaps an alternative way to get a hold of my listboxes from within my javascript?



2 Replies
Partner - Contributor III
Partner - Contributor III

Hi Padraic, the GetObject-Function is asynchronous. You need to await the callback of this function with `SetOnUpdateComplete()`. You could try something like this: var mydoc = Qv.GetCurrentDocument(); var ch    = mydoc.GetObject("LB02"); ch.SetOnUpdateComplete(()=>{   alert(ch.Layout.ObjectId); });

Luminary Alumni
Luminary Alumni

I did, but get multiple submissions of the callback. How do I avoid that?