Qlik Community

QlikView Documents

QlikView documentation and resources.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW

Loading Expressions From File - WITHOUT creating variables in Script

vinieme12
Champion II
Champion II

Loading Expressions From File - WITHOUT creating variables in Script

I've been reading a lot of discussions about loading expression from external files and most of them suggest on creating variable in the load script using peek. Here are my thoughts

Downside of creating variables in the Script:

  • Too many variables to create for a large scale project

  • For any additions or removal of any expression you will be forced to edit both your external file and the load script.

  • Extra line of scripting for each variable

Attached is Sample that lets you evaluate your expressions Loaded from an excel file directly in your chart.

The Trick is simple, make your string evaluate as a Variable using the Dollar Expansion in the chart

Cheers

V

Attachments
Comments
ToniKautto
Employee
Employee

The use of Aggr() seems unnecessary. I would suggest using Only() instead, to make the expansion more efficient.

=$(=Only({<ExpressionFOR={'Sales'}>} FORMULA))

vinieme12
Champion II
Champion II

Yep, totally forgot about that   Thanks @Toni

0 Likes
vinieme12
Champion II
Champion II

incorporated ONLY() as suggested

0 Likes
santiago_respane
Specialist
Specialist

Excellent approach, will give it a try!!

Thanks for sharing!

0 Likes
sunny_talwar

Looks great, will have to deep dive to see what its doing. Thanks for sharing

0 Likes
qlikviewnovice
Specialist II
Specialist II

Great!! Very Helpful

0 Likes
rwunderlich

I don't think there is anything wrong with what you are doing. However, I think the downsides you listed for the variable approach are incorrect. Perhaps you are not familiar with the script loop to load variables from a file? The exact same spreadsheet you provided for your sample can be used to load variables as well.  Variables are loaded in a loop, and no script changes are necessary when variables are added or removed.

Storing variables outside of QlikView - The Qlik Fix! The Qlik Fix!

vinieme12
Champion II
Champion II

Thanks Rob,

I had not come across this.

Thanks

Vineeeth

0 Likes
nishaloganathan
Creator II
Creator II

Nice article !!!. Thanks for sharing

0 Likes
cheburashka
Creator III
Creator III

Hello,

I agree with Rob.

Downside of creating variables in the Script:

  • Too many variables to create for a large scale project

           -->Creating variables in the script, does not influence how many variables you have to create.

  • For any additions or removal of any expression you will be forced to edit both your external file and the load script.

           --> A loop fixes this.

  • Extra line of scripting for each variable

          --> Not if you use a loop.

I wonder what the performance of this method is compared to actually creating variables with expressions.

Do you have an example app where you compare the 2 methods?

Reading variables from an external file and creating them in the script can be easily done with the qvc.populatevariables subroutine of the Qlikview Component Library.

,KR Koen

0 Likes
Version history
Last update:
‎2016-08-30 02:18 AM
Updated by: