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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Importing formulae into variables - Can i stop qlikview trying to evaluate the formula when loading?

Hi,

Can anyone help with the following

I have a table containing the ScorecardMonth and a string that I want to use as part of a formula in a scorecard

e.g.

ScorecardMonth YTDFormula

May 2010 {<Month = {'Apr 2010', 'May 2010'}

Jun 2010 {<Month = {'Apr 2010', 'May 2010', 'Jun 2010'}

I then have a variable in my document which is set to the value of YTDFormula

YTD = YTDFormula

So that when I change the scorecardmonth, the variable updates

Then, finally, I, have another set of variable, which utilise this YTD variable

For instance

vKPI1 = Count($(YTD), EmpStatus = {'Active}>} [Employee NO])

This works, the formala work and update correctly when i change the scorecard month.

Problem arises when i try and load the values for my KPI variables. I use the script as follows to load the variable values and names from an table which i hold in Excel







LOAD

YTDVariableName

,

YTDVariableValue

FROM

KPILoad.xls

(

biff, embedded labels, table is KPIs$)

;

LET

RowCount = NumMax(NoOfRows('VariableList'),0)-1

;

FOR

i=0 to

'$(RowCount)'

LET

TempVarName = peek('YTDVariableName',$(i),'VariableList')

;

LET

TempVarValue = peek('YTDVariableValue',$(i),'VariableList')

;

SET

$(TempVarName) = $(TempVarValue)

;

NEXT





This loads most of the variables perfectly, apart from when one of the variables contains reference to another variable

e.g.

vKPI1 = Count($(YTD), EmpStatus = {'Active}>} [Employee NO])

gets loaded as

vKPI1 = Count(= YTDFormula, EmpStatus = {'Active}>} [Employee NO])

because Qlikview has resolved the variable in the script, i think it does this at the stage where I

LET

TempVarValue = peek('YTDVariableValue',$(i),'VariableList')

Is there anyway i can stop Qlikview doing this and just get it to load the string for my variable? I've tried using SET instead of LET but then it sets the variable to

peek('YTDVariableValue',$(i),'VariableList')

Any ideas? Thanks in advance.

0 Replies