Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
krishnajamylavarapu16
Contributor III
Contributor III

variable from prj folder having issues

Hi Community,

I reloaded my report from prj folder and stored variables into a qvd file. 

For chart dimensions I use =$(vDim.RptPeriod) . When i reloaded the report from prj folder, the expression for a single variable is as below : 

vDim.RptPeriod  =  if(Period_Key>==FieldValue('RptPeriod_Key', FieldIndex('RptPeriod_Key', =Max(RptPeriod_Key)) + 5)
and Period_Key<==Max(RptPeriod_Key), Period)

In the original report, the variable value should be as below :

vDim.RptPeriod = if(Period_Key>=$(vMinRptPeriod) and Period_Key<=$(vMaxRptPeriod), Period)

vMinRptPeriod = Max(RptPeriod_Key)

vMinRptPeriod = FieldValue('RptPeriod_Key', FieldIndex('RptPeriod_Key', $(vMaxRptPeriod)) + 5)

As I am loading the variables from prj folder, the variable has changed. This is throwing error on the report and the error is - //Error in Calculated Dimension

Request help on this.

2 Replies
krishnajamylavarapu16
Contributor III
Contributor III
Author

Below is the code i have used to store and load variable values : 

// Added to store varaibles
VariableNames:
LOAD Name AS VariableName

FROM [FileName-prj\AllProperties.xml] (XmlSimple, Table is [AllProperties/VariableProperties/VariableProperties]);

FOR i=0 TO NoOfRows('VariableNames')
LET varName = Peek('VariableName', $(i), 'VariableNames');
LET varValue = $(varName);

Variables:

LOAD
'$(varName)' AS VariableName,
'$(varValue)' AS VariableValue
AutoGenerate 1;

NEXT

STORE Variables INTO Variables.qvd (QVD);
DROP Tables VariableNames, Variables;

// Added to Load variables from QVD File

Variables:
LOAD VariableName,
VariableValue
FROM Variables.qvd (qvd);

FOR i=0 TO NoOfRows('Variables')
LET vVar = Peek('VariableName', $(i), 'Variables');
LET vVal = Peek('VariableValue', $(i), 'Variables');

LET '$(vVar)' = '$(vVal)';
NEXT

Brett_Bleess
Former Employee
Former Employee

@krishnajamylavarapu16  I think the better way to handle this would be to just put all the variables etc. into a text file and use the Include function to pull that straight in from the text file instead of trying to go at is as you are currently.  Here is the Help link on Include function:

https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/Scripting/Syste...

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.