Skip to main content

QlikView Integrations

Discussion Board for collaboration on QlikView Integration.

CUSTOMERS ONLY: Now accepting customer applications for the 2023 Luminary Program: SUBMIT NOW
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to use JS API in Extension

I am an experienced javascript developer building my first QlikView 11 extension for a customer.

The customer has provided me with a sample QVW file that has 5 Text Objects on a sheet. The text is set to display "=$(%%v_SelString1)" in the first Text Object and on to "=$(%%v_SelString5)" in the fifth.

That gets rendered to the screen as a string that contains some data I need to get to in my extension. I'm not going to have those Text Objects in the sheet or document at all in a final version of the QVW that includes my extension.

How can I get the value of =$(%%v_SelString1) using the JS API?

Thanks for any help that can be offered in explaining what "=$(%%v_SelString1)" is and how to get to it from my extension javascript code.

4 Replies
Not applicable

I found this in another post and am able to get it to find the variables I need:

    var doc = Qv.GetCurrentDocument();
    var varsRetrieved = false;
                var varlist = "";
                //Let pids = =concat(distinct [$(=$(%%v_SelectedKey($1)))], '$(%%v_SelValuesDelimiter)', [$(=$(%%v_SelectedKey($1)))]);
                for(var i = 0; i < variables.length; i++){
                    if ("v_SelectedKeyValues") != -1) {
                        varlist += + " = " + variables.value + "\n";
                //alert("pids" + " = " + pids + "\n" + varlist);
            varsRetrieved = true;

the problem that remains is that it doesn't give me a value, but an equation instead:

concat(distinct [$(=$(%%v_SelectedKey($1)))], '$(%%v_SelValuesDelimiter)', [$(=$(%%v_SelectedKey($1)))])

I need to know how to get the value of that equation in my extension script.

Master II
Master II

Change your variable, add a "=" sign at the start, as the first character.

Not applicable

I'm not sure what you mean. How would I, for example, get the value of a document variable named "%%v_SelString1" to display in an alert?

Not applicable

I made some progress on this by adding a text field to the definition likes this:

<Text Initial="" Expression="=$(%%v_SelectedKeyValues(1))"/>

Turns out the "variable" I was after is actually a function, and i need to pass in an index value as a parameter.

I was able to print the value using this line in my extension script:


While thats good progress and i'm learning, I still haven't solved my problem. I need to get the value of %%v_SelectedKeyValues(n) from my extension script.

Thanks for the help so far!