Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Peek function returning null after SQL statement.

When I run the following code the peek command seems to stop working after the SQL select command.

For the second row vTable,vField & vDescr are set to Null when for k = 0 to $(y) is on it's second pass.

Any ideas why this is happening?

Mark


tmp:
load * inline [
TABLE, FIELD,DESCR
'ITMMASTER','ITMREF_0','Product'
'BPCUSTOMER','BPCNUM_0','Customer'
];

Counts:
LOAD Count(FIELD ) as Y
Resident tmp;
LET y = Peek('Y', 0) - 1;
DROP Table Counts;

for k = 0 to $(y)

LET vTable = PEEK('TABLE', $(k));
LET vTable = 'IDIS.' & vTable ;
LET vField = PEEK('FIELD', $(k));
LET vDescr = PEEK('DESCR', $(k));

LOOKUPS:
SQL SELECT $(vField) AS LOOKUP_FIELD, '$(vTable)' AS LOOKUP_TABLE from $(vTable);

NEXT k


1 Solution

Accepted Solutions
Not applicable
Author

I needed to explicitly set the table in peek, this has made it work.

LET vField = PEEK('FIELD', $(k),'TMP');

View solution in original post

2 Replies
Not applicable
Author

I needed to explicitly set the table in peek, this has made it work.

LET vField = PEEK('FIELD', $(k),'TMP');

Not applicable
Author

Had the exact same issue, thanks for adding your solution.