Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ali_hijazi
Partner - Master II
Partner - Master II

pass variables from one document to another

Hello

I have a document that is binary-reading from another document

What I want is also all the variables of the first document be available to the second document

is this possible?

Please advise

I can walk on water when it freezes
1 Solution

Accepted Solutions
ali_hijazi
Partner - Master II
Partner - Master II
Author

and here it is

Please mark as correct answer!!!

Note: Daily_Sales below is the target or the new document to copy variables to

sub CopyVariables

set vars = ActiveDocument.GetVariableDescriptions

  set App = ActiveDocument.GetApplication

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

for i = 0 to vars.Count - 1

    set v = vars.Item(i)

    set variable = ActiveDocument.Variables(v.Name)

 

    UserFile.CreateVariable v.Name

          set v = UserFile.Variables(v.Name)

          v.SetContent Variable.GetContent. String,true

          ActiveDocument.ClearAll false

next

end sub

Message was edited by: ali_hijazi

I can walk on water when it freezes

View solution in original post

7 Replies
jagannalla
Partner - Specialist III
Partner - Specialist III

Hi,

This is good thing to learn. But I know how to pass parameters from one qvw file to another using macro code in first qvw file. You can get more details in this link

http://community.qlik.com/message/270203#270203

Hope it helps you

Cheers!!

Jagan

jagannalla
Partner - Specialist III
Partner - Specialist III

Hello,

Please find the two files. Open the file community_25.qvw and click on navigate button. It will navigate to Community_26.qvw file along with variable Var_A_01 content to seond qvw file. You can test it, Click on Navigate button and open variables tab in document properties and see the value of Var_A_01 in second file. Make sure both files should locate at same path.

Hope it helps you

Cheers!!

Jagan

ali_hijazi
Partner - Master II
Partner - Master II
Author

Now I understood the code

what I actually need is copy all available variables from one document to another

I'll try to upgrade the code so that it loops through all variables of one document and saves them to the other one

I can walk on water when it freezes
ali_hijazi
Partner - Master II
Partner - Master II
Author

and here it is

Please mark as correct answer!!!

Note: Daily_Sales below is the target or the new document to copy variables to

sub CopyVariables

set vars = ActiveDocument.GetVariableDescriptions

  set App = ActiveDocument.GetApplication

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

for i = 0 to vars.Count - 1

    set v = vars.Item(i)

    set variable = ActiveDocument.Variables(v.Name)

 

    UserFile.CreateVariable v.Name

          set v = UserFile.Variables(v.Name)

          v.SetContent Variable.GetContent. String,true

          ActiveDocument.ClearAll false

next

end sub

Message was edited by: ali_hijazi

I can walk on water when it freezes
Not applicable

Is there any way to pass variable value without using macro.

Regards

Sagar Gupta

Anonymous
Not applicable

This macro doesn't work with AJAX !!!

an idea to fix it ??

regard

Not applicable

Hi

It is helpful for me.

But I m not getting the how the variables are passed.

Actually i want to open different document with sheet number passed from one parent document