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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Problem with Peek function

My goal is to load meta data that has a field with values that I want as variable. Here's the the script snippet. Essentially i do while loop through a table and want to assign the contents of field KPIFormula to a variable that will be named as per the value in ReportingVarName. The issue is that peek is not returning anything (probably return null). THe script runs but there is no value associated with the variable:

1)mytest

2)myvarname and

3)the dynamic variable that I'd like to be set as per the value in ReportingVarName.

For a starter, I'd be happy if i could just get peek working on "mytest" variable. Any help is appreciated. Note that the do while loop is working because the value of RowCnter starts at 0 and ends up at 42 which is the number of rows in the table "KPIData".

KPIData:
LOAD [Used],
[Checked],
[Reporting Name] as KPIName,
[Stat Type] as KPIType,
[Stat Name] as StatisticName,
[Stat Formula] as KPIFormula,
[LS Table Name] as TableName,
[Datamart Table] as DMTableName,
[Datamart Column] as DMColumnName,
[Column Description] as KPIDescription,
KPIFormatValue,
ReportingVarName
FROM
..\KPIData\KPIData.xlsx
(ooxml, embedded labels, table is Sheet1);



Let KPITableRows = NoOfRows('KPIData');
Let RowCnter = 0;

do while RowCnter < KPITableRows

let mytest = peek('[Stat Name]', 5, 'KPIData');

let myvarname = peek('ReportingVarName', $(RowCnter), 'KPIData');
let $(myvarname) = peek('KPIFormula', $(RowCnter), 'KPIData');
let RowCnter=RowCnter + 1;

loop

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

I figured it out. I use a qualify * statement (and then unqualify attributes as I need them for association) earlier in the script to ensure my data model is correct. That screwed up my peek statement because it expected a fully qualified table.attribute name.

View solution in original post

1 Reply
Anonymous
Not applicable
Author

I figured it out. I use a qualify * statement (and then unqualify attributes as I need them for association) earlier in the script to ensure my data model is correct. That screwed up my peek statement because it expected a fully qualified table.attribute name.