Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
jduenyas
Specialist
Specialist

Copy variable

Hello gurus

I have created a new document with a Binary load from an existing one.

However, variables are not being copied/transferred with the Binary load.

Is there a way to copy all variables (i have many of them) from the existing document to the new?

 

Thanks

2 Solutions

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

This is how you can retrieve the variable info:

 

VARIABLE:
LOAD 
    Name,
    IsConfig,
    IsReserved,
    RawValue
FROM 
  [C:\Program Files\QlikView\Examples\Documents\Getting Started.qvw] 
  (XmlSimple, Table is [DocumentSummary/VariableDescription]);

View solution in original post

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

This blog post contains the code to both load and recreate the variables: https://qlikviewcookbook.com/2018/06/loading-variables-from-another-qvw/

View solution in original post

11 Replies
petter
Partner - Champion III
Partner - Champion III

Yes the variables are not part of the data model of QlikView or Qlik Sense.

And yes there is a way of getting hold of the variables by reading them from the QVW-file. The QVW-file has an XML-section where the variables are accessible. 

You will have to read the QVW-file from a load script with a LOAD statement using XML as the file format. Then you will get all the variables into a table. The table can be parsed with a simple FOR loop afterwards to recreate each and every variable.

 

petter
Partner - Champion III
Partner - Champion III

Another approach is to make a QlikView macro with either VBScript or JScript (JavaScript). There is an API that let you manipulate and read anything in a QlikView document - variables are also fully accessible this way.

 

Furthermore there are applications being made as "open-source" to do the job:

 

ImportExportVariables.png

jduenyas
Specialist
Specialist
Author

Thanks.

A little more help... Using QlikView not QlikSense

Where can the XML section be found?

petter
Partner - Champion III
Partner - Champion III

This is how you can retrieve the variable info:

 

VARIABLE:
LOAD 
    Name,
    IsConfig,
    IsReserved,
    RawValue
FROM 
  [C:\Program Files\QlikView\Examples\Documents\Getting Started.qvw] 
  (XmlSimple, Table is [DocumentSummary/VariableDescription]);
jduenyas
Specialist
Specialist
Author

You are the BEST!!!

Thanks for your help

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

This blog post contains the code to both load and recreate the variables: https://qlikviewcookbook.com/2018/06/loading-variables-from-another-qvw/

jduenyas
Specialist
Specialist
Author

Thank you Rob.

You always come through!

What would we do without you?  😊

sayalip
Contributor II
Contributor II

That script helps to get variables in application but my question is how we can create variable in application . Any suggestions?

sayalip
Contributor II
Contributor II

I am using that script i have imported 100 variables now i want a script using that i can create all variable in my application instead of manual work. is it possible.