Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Export Variables from an application.

Hi,

Is there any way by which we can export all the variables created in the application (During the reloading or development).

Vivek

14 Replies
giakoum
Partner - Master II
Partner - Master II

then you could remove the = in a copy of your application and use Johannes approach.

But maybe this way works also :

3:

LOAD

          '$(Variable1)' as Variable1

          ,'$(Variable2)' as Variable2

AutoGenerate(1);

STORE [3] into c:\Variables.txt (txt);

Not applicable
Author

thnxs a lot...

Not applicable
Author

Superb, for new users like me, this is very useful.  Thanks

Anonymous
Not applicable
Author

In order to fetch those variables that contain formulas you might go to:

Settings, Expression Overview (Ctrl+Alt+E)

Check "Other Expressions"

They are listed at the end, without Variable name in the first place.

So click the Button "Column" and choose "Location(Full)"

That contains information on the variable name

You can export this and get rid of the unnecessary "<Document>.<Variable="xxx">" construct with an easy general search/replace in any text editor easily.

If you want to transfer the definition of you variables into the load script, you might give a try to the following approach:

I use RegEx here. For those who are not familiar with it, you might find your own way. What we do here is basically add a line for each variable int the load script that is like

LET Variable = 'Expression'

It has to be LET, not SET in order to work properly.

You must not have apostrophes in your expressions, so you have to split the expressions and concatenate them with chr(39) again as chr(39) stands for an apostrophe.

So this is how you bring the magic of RegEx into this:

If you use an editor that supports RegEx (Notepad++), you can transform the Export to a QlikView load script by searching

(\n\t*<Document>\.<Variable=)(.*)(>\t)(.*)(\r)

and replace it by

LET $2 = '$4';

(in RegEx mode)

If your expressions contain apostrophes, you FIRST need to replace these by searching for

'

and replace it by

'&chr\(39\)&'

(in RegEx mode)

or by

'&chr(39)&'

(in standard mode)


If your expressions contain $ sign expansion, you need to replace these dollar signs by searching for

\$

(in RegEx mode) or

$

(in regular mode)

and replace it by

'&chr\(36\)&'

(in RegEx mode)

or by

'&chr(36)&'

(in standard mode)


That gives you a series of LET expressions that you can easily paste into the load script.

Any later changes to you variables definitions has to happen in the oad script then, as it woul get overwritten any time you run the load script again.


If you need the "other" variables (those not containing a formula) as well in the load script, you might follow Johannes apporach, transform the output in Excel to SET expressions with an Excel  formula like ="SET "&A1&" = "&C1&";" and paste this into the QlikView load script before the above generated LET expressions.

That way, you get all variables where the ones that are defined by a formula are also still defined as formula because the following LET overwrite the (in these cases wrong) SET definitions.

prbnrs11
Contributor
Contributor

Thank you so much. You are awesome