Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
joshabbott
Creator III
Creator III

Pass a variable value to a QlikView Document

Is it possible to have a trigger in QlikView that will 'Open QlikView Document' and pass that document a value for a variable?

For instance, say I have a document called doc1.qvw

I also have a variable called var1 in doc1.qvw

When they click a button on another document, I would like to 'Open QlikView Document' doc1.qvw and set the value of var1 = 1.  I tried:

doc1.qvw&var1=1

and this doesn't seem to work, I'm thinking since it is the 'Open QlikView Document' action, it isn't recognizing the passing of parameters for the variable value

9 Replies
Anonymous
Not applicable

You need to mark "Transfer State"

opendoc.png

joshabbott
Creator III
Creator III
Author

I tried this, and it didn't copy the variable value over.  Is that what you were thinking it would do?

ashfaq_haseeb
Champion III
Champion III

Hi,


This is not supported you can vote for the Idea here.

http://community.qlik.com/ideas/2359

if you can you use the QVP protocol instead then use below

qvp://YourServer/Doc.qvw?&myvar=1


Regards

ASHFAQ

sundarakumar
Specialist II
Specialist II

If possible u can create an inline field with all the possible values of variable and select it in the first document which will be passed to the second document through document chaining if u create the same inline field in second document.

-Sundar

joshabbott
Creator III
Creator III
Author


I think this is the right track.  Based on passing that through a field named MyState (for instance, 1), I'd like a different sheet to be opened.  I tried both on change on the inline field, and on open of the second qvw, and it isn't working correctly.  It will only change the sheet to the first sheet in the field even if MyState = 2.

=If(Only(MyState) = 1, 'SH01', 'SH02')

joshabbott
Creator III
Creator III
Author

I'm attaching an example:

doc1.qvw has inline load of MyState (1 or 2).  It also has a button ('OPEN DOC') that opens a QlikView document doc2.qvw and transfers state

doc2 has two sheets (SH01 and SH02).  It also has the same inline load of doc1.qvw.  There are actions on open of the document and on select of MyState:

=if(Only(MyState) = 1, 'SH01', 'SH02')

If I change the values around on doc, and open the new doc, it doesn't take me to the new sheet but does carry over the selection.  From doc2, if I make different selections, it changes the sheet.  Any ideas?  Thank you for everyones help!

joshabbott
Creator III
Creator III
Author

Ooops, attachments:

rubenmarin

Also you can create a macro:

sub OpenDoc

    set App = ActiveDocument.GetApplication

    set newdoc = App.OpenDoc(".\test2.qvw")

    Set v = ActiveDocument.Variables("Var")

    Set v2 = newDoc.Variables("Var")

    v2.SetContent v.GetContent.String, true

   

end sub

dmohanty
Partner - Specialist
Partner - Specialist

Hi joshabbott‌,

You can achieve this in  below way, but make sure you do the data validation after document is chained.

  • Make sure both the documents have the same variable.
  • Open document properties in Document 1 (source document) and go to Variable tab.
  • Then for each variable that you want to pass to the Document 2 (Chained document), check the box 'Include in bookmark' in Document 1.

As QlikView server uses bookmark when chaining document, it will pass the variables values to the new opened application, like for the selections.

Let us know if this helps!