Qlik Community

Ask a Question

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Talk to Experts Tuesday, January 26th at 10AM EST: Qlik Sense. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Partner
Partner

Passing parameters from one qvw file to another

I saw some posts but none shows a simple way to pass one or two parameters to a new .qvw file you open with a button, such as from a "parent" menu app to a child data-crunching app.

Any hints at where to look for?

Thanks

Flavio

1 Solution

Accepted Solutions
Partner
Partner

My final answer came after a suggestion from QV and some experimenting. I tried to get out all specific references and italian language (hope it still works 😉 Thanks to all that contributed. If anybody needs to make it clearer I can attach a sample.

This code should be in the "menu" file that needs to open a "secondary" file and set a variable there with a value that was set in the first one.

The secondary file should just have a variable with that name defined. Both documents are left open.

<code/>

sub runDoc

set Var=ActiveDocument.Variables("Var_A_01")

set App=ActiveDocument.GetApplication

set UserFile = App.OpenDoc ("filename.qvw","","")

set v = UserFile.Variables("Var_B_01")

v.SetContent Var.GetContent. String,true

ActiveDocument.ClearAll false

end sub

</code>



View solution in original post

26 Replies
Master II
Master II

Hi Flavio,

saw something in announcement for version 9.0 - but have never tried to do so.

Peter

Not applicable

I don't know if I understood your question correctly, would passing the variable values through command line help you? i.e. qv.exe /r /Variable=value

Champion III
Champion III

No need for /r unless you want to reload. Only /v to assign variable value.

Peter, there is action "Open QlikView Document" in QV9, and it can copy the selections. Here it is from "help":

Open QlikView Document

Opens the specified document and applies the selections of the original document. The file extension must be included.

Mark the check box Transfer State to transfer the selections from the original document to the one you wish to open. The opened document will first be cleared of selections.

Mark Apply state on top of current to retain the second document's selections and apply the original document's selections on top of them.



Partner
Partner

Thanks, I would have hoped for an API like Application.Document.Variable("1") ... 😉 but passing a parameter in the command line could work. I want to emulate the security passing its parameters to another file (if you set it you don't have to retype you login with all new files). I need my own additional security built-in.

Problem is that it gives me an error "Failed to execute qv.exe". I also set the variable in the 'second' file so that only the value would have to be passed (after another post advice).

I used the execute action behind a button:

Application qv.exe

Filename xxxxxx.qvw

Parameters /v%Test='aaa' (the variable name is %Test ?)

Directory omit as it is the same

The Transfer State transfers only the selections? Is it possible that "undocumented" there are some other "hidden" options that I could use?

Flavio

Partner
Partner

My final answer came after a suggestion from QV and some experimenting. I tried to get out all specific references and italian language (hope it still works 😉 Thanks to all that contributed. If anybody needs to make it clearer I can attach a sample.

This code should be in the "menu" file that needs to open a "secondary" file and set a variable there with a value that was set in the first one.

The secondary file should just have a variable with that name defined. Both documents are left open.

<code/>

sub runDoc

set Var=ActiveDocument.Variables("Var_A_01")

set App=ActiveDocument.GetApplication

set UserFile = App.OpenDoc ("filename.qvw","","")

set v = UserFile.Variables("Var_B_01")

v.SetContent Var.GetContent. String,true

ActiveDocument.ClearAll false

end sub

</code>



View solution in original post

Not applicable

Hi Flavio,

Actually am new to QlickView.

I have the requirement which sounds similar to this.

I have one document where am showing the list of reports to the user, then the user will select the reports as per his wish.

Once he clicks on one report name, that specific document should open up in other window(which is another Qvw document), and again the user should able to come back to the original document to select other document as well.Its something like calling other document from the existing one / navigating from one document to other.

Am i clear here?

Could you please help me out in this ?

Thanks in adavance,

Mahasweta

Partner
Partner

Hi! I am not sure I can attach a sample. There are around a qvw-launch and qvw-target to exemplify this solution using the Transfer State option that Michael above was suggesting. This makes available on the second doc all selections you had on the launching app.

You can very simply, though, create a button and with the Action tab/External launch another qvw file without any code. The same you can do with an action on whatever object in your target doc making you able to go back to the "Main menu" feature.

My "solution" was more specifically about passing some parameters, such as information you gather with your first "screen" that you want to use in the second without writing it to a database but keeping them as variables. As for the "Report", if you mean literally, I have never used that function in QV but sure you can open a new file and launch any function "On Open" provided you are able to write some code (see the API guide).

Flavio

Not applicable

There's a good example of this feature :

Just watch in the "What's New in QV9.qvw" file, and look at the "View Finance" Button on the DashBoard Sheet (bottom left), which launch the "Finance Controlling.qvw" file with parameters...

Enjoy,

Eric.

Partner
Partner

Yes! This is a fantastic example of opening a new doc and passing "selections" (i.e. elements from the data structure). I had overlooked it when looking for this kind of solution.

The final solution I proposed, instead, passes (sort of shares) parameters as doc variables.

Thanks, hope that this leads to a solution for Mahasweta

Flavio