Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi there,
I am trying to load a list of tables. The first table works correctly, but the peek function cannot find the second table. Does anybody know what is wrong in my script?
===========================
[Tables]:
load * inline [
TableName
PJ_HEADERS
LK_KLANT
];
FOR i=0 to NoOfRows('Tables')-1
let t=Peek('TableName', $(i));
trace table to read is $(t);
set st= SELECT * FROM $(t);
trace sql statement is $(st);
$(t):
LOAD *;
SQL
$(st);
NEXT;
===============================
Hi,
Change:
let t=Peek('TableName', $(i));
to
let t=Peek('TableName',i,'Tables');
The reason why the statement is failing is:
If no table_name is stated, the current table is assumed. If used outside the LOAD statement or referring to another table, the table_name must be included.
So after first iteration Peek function is looking for 'TableName' in PJ_HEADERS table.
KR
Marcin.
Hi,
Change:
let t=Peek('TableName', $(i));
to
let t=Peek('TableName',i,'Tables');
The reason why the statement is failing is:
If no table_name is stated, the current table is assumed. If used outside the LOAD statement or referring to another table, the table_name must be included.
So after first iteration Peek function is looking for 'TableName' in PJ_HEADERS table.
KR
Marcin.
Many thxs for your quick reply, Marcin. This works