Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
This is confusing me! I have a table which I can correctly peek at values in using the following:
let y = peek('page', 0, FacebookProConnector_Page); // y = "value1'
let y = peek('page', 1, FacebookProConnector_Page); // y = "value2'
let y = peek('page', 2, FacebookProConnector_Page); // y = "value3'
However, in a for loop, e.g.:
let noRows = NoOfRows('Table1');
for i=0 to $(noRows) // loop through every row
let y = peek('page', $(i), Table1);
// Additional load statement to other table here
next
I get weird behaviour.
- in the first iteration (i=0), y is correctly 'value1'
- In the second iteration (i=1), y = NULL ?????
But this only happens if I have the additional load statement (where the comment is above) present. If I remove the inner load to another table (and just have an empty loop) it seems to work ok.
I can't see what I could be doing wrong - would appreciate any ideas.
This is happening QlikView 9 desktop.
Hi Chris,
When I added quotes around the 'table name' it seemed to work, so:
let y = peek('page', 0, 'FacebookProConnector_Page');
instead of
let y = peek('page', 0, FacebookProConnector_Page);
Hi,
What is you Additional load statement ?
Structurally it is along the lines of this.
for i=0 to $(noRows) // loop through every row
let y = peek('page', $(i), Table1);
let x = peek('page_id', $(i), Table1);
Table2:
LOAD
$(x) as field_id,
field1,
field2,
etc.
FROM
[http://localhost:5555/QVSource/Connector/?config=$(y)]
(txt, utf8, embedded labels, delimiter is '\t', msq);
next
I see anything wrong.
Have you a value for i=2, i=3 or always NULL ?
Is your X variable is in numeric format ?
Hi Chris,
When I added quotes around the 'table name' it seemed to work, so:
let y = peek('page', 0, 'FacebookProConnector_Page');
instead of
let y = peek('page', 0, FacebookProConnector_Page);
Thanks rsmeding! - That fixed it!
The QlikView docs/help file seems to suggest you don't need/use the apostrophes but it seems you do.
Hi Chris,
This is a common error and a difficult to debug issue. There used to be an article in the old wiki about it but that wiki is now gone.
What happens is this. Without the quotes, the tablename is not correcly resolved and so defaults to the current table. When you add the load statement, you change the current table to a table that did not contain field "page".
-Rob
Hi Rob,
Thanks for the additional info - good to know it wasn't just me..
Hi all,
they should change or mention this in the doc. There are several issues in the doc we've pointed out earlier. Maybe we can collect those things in the QlikBug group.
- Ralf
I started to write a bug report and then realized this is not a bug, although it could probably use some clarification. It's legal to use a fieldname to reference the tablename, in which case you would not quote. For example:
data1:
LOAD * INLINE [
V1
1
2
];
data2:
NOCONCATENATE LOAD * INLINE [
V1
5
6
];
control:
LOAD * INLINE [
Table
data1
data2
];
new:
LOAD
Table,
peek('V1', 0, Table) as PeekVal
RESIDENT control;