Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
We have implemented source control using the TFS integration.
Unfortunately, variable values are stripped out. I guess the process treats is as "data" and therefore it is not stored.
I am a heavy user of variables to simplify set analysis expressions and reuse calculations between charts and KPI gauges, so would really like it stored in source control.
Variable values are considered as data and therefore not saved in the PRJ folder.
By declaring the variables in the load script they will be stored in the PRJ folder and thereby will not vanish.
It is known that in some cases variable definitions containing dollar expansions can lead to the desxribed issue. For these situations please use the workaround that was already identified above, meaning that you split the expression into two strings forcing the dollar expansion to not be expanded in the script but rather when called in application.
Have you tried to define variables in the script editor instead?
That nearly works. The problem is some of the set analysis expressions.
='=Sum({$ <PremiumReceivedYearNum={$(=vMaxFinancialYearNum)} >} PremiumReceived)'
becomes
=Sum({$ <PremiumReceivedYearNum={(internal error)} >} PremiumReceived)
A workaround could be to use
LET EXPR='=Sum({$ <PremiumReceivedYearNum={$'&'(=vMaxFinancialYearNum)} >} PremiumReceived)'
instead of
SET EXPR='=Sum({$ <PremiumReceivedYearNum={$(=vMaxFinancialYearNum)} >} PremiumReceived)'
Thanks, that works. It will suffice as a workaround for now.
Variable values are considered as data and therefore not saved in the PRJ folder.
By declaring the variables in the load script they will be stored in the PRJ folder and thereby will not vanish.
It is known that in some cases variable definitions containing dollar expansions can lead to the desxribed issue. For these situations please use the workaround that was already identified above, meaning that you split the expression into two strings forcing the dollar expansion to not be expanded in the script but rather when called in application.
My next issue is with variables that include single quotes in the expression.
A variable with the expression
=Date(AddMonths(Max(YearMonth), -12), 'MM-YYYY')
Needs to be written as
LET v12MonthsToMax ='=Date(AddMonths(Max(YearMonth), -12), ' & chr(39) & 'MM-YYYY' & chr(39) & ')';
You can avoid that using SET instead of LET (SET simply assigns everything after the equal sign to be the variable content, single quotes or no). However, you can't avoid dollar sign expansion using SET, so if you need both, you need to write a convoluted expression.
Thanks Kuba
Another option, that does not require unescaping/replacing, is storing the variables in an external file, load them into a temporary table and directly assign them using the peek function. You can find an example here: http://www.qlikfix.com/2011/09/21/storing-variables-outside-of-qlikview/