Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I need to Copy the Variables from qvw1.qvw to qvw2.qvw . For this, I have attached the qvw1 and qvw2 files. Please refer attachments.
In qvw1 , I have Created Variables with values as below:
Var_A : 15 , Var_B : 17, Var_C: 18
In qvw2 , I have Created Variables with values as below:
Var_A : 35 , Var_B : 37, Var_C: 38,Var_D : 9
When I want to copy the Variables from qvw1 to qvw2 , if the same variables are already existing in qvw2 , it should not be replaced with qvw1, it should be added as Var_A_qvw1 : 15 , Var_B_qvw1: 17, Var_C_qvw1:18
In qvw2 , My variables should be like below after Copied:
Var_A : 35 , Var_B : 37, Var_C: 38,Var_D : 9 , Var_A_qvw1 : 15 , Var_B_qvw1: 17, Var_C_qvw1:18.
For this, Could you please provide the Vb Macro script to achieve the above. I am attaching qvw1 and qvw2. Could you please help me asap.
Have a look here: Variables
- Marcus
Harish,
Use this
sub CopyVariables
set vars = ActiveDocument.GetVariableDescriptions
set App = ActiveDocument.GetApplication
set UserFile = App.OpenDoc("Qvw2.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
OR ELSE
Just create one input variable object with those variables(Add All) and then send it to Excel. After that put some names which columns in excel. Then use this for scripting
Hi Anil,
I am using the same code. This is not adding the variables into qvw2 . It
is replacing the same variables in qvw2.
Hi Marcus,
I have tried the code in both the links below:
Macro to Copy Variables In From Another Document
<http://qlikviewmaven.blogspot.de/2013/03/macro-to-copy-variables-in-from-another.html>
More on Copy Variables From One Document to Another
<http://qlikviewmaven.blogspot.de/2013/03/more-on-copy-variables-from-one.html>
But it is not worked. Getting Open Failed Document. I need to add the
same variables in qvw2 , even though the same are existing in qvw1. Not
to replace.
Could you please help me .
On Mon, Jul 11, 2016 at 7:08 PM, Marcus Sommer <qcwebmaster@qlikview.com>
Which code you are using. First one or second one.