Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
So there is a logic to get TableName list:
for i=0 to nooftables()-1
TableList:
Load
tablename($(i)) as TableName
Autogenerate 1;
next i
Now I want to simplify this to a one load with Autogenerate and TableName() function returns NULL():
TableList:
Load
tablename(RecNo()-1) as TableName,
RecNo(),
RowNo()
Autogenerate nooftables();
Also have tried with Preceding Load and still nothing:
TableList:
Load
tablename(rec_no-1) as TableName,
rec_no,
row_no;
Load
RecNo() as rec_no,
RowNo() as row_no
Autogenerate nooftables();
It seems like a bug to me - TableName() responds only if we put integer or recalculated variable there.
Any thoughts on this?
Just a hint to the documentation which doesn't contained an information anymore which has probably not (entirely) changed n the years and this is that (all) table/field-functions expects (normally) a string as table/field-name and not a normal table/field-call - means also a call of:
tablenumber('My Table')
If I remember correctly this was a must in the old days. Nowadays it might be often working without it because the context of a call defined the interpretation ... but honestly I'm not sure that this is always true.
Beside this I played a bit more with the matter and found some kind of workaround by using:
t1: load recno()-1 as R autogenerate nooftables();
t2: load evaluate('tablename(' & R & ')') as TableName, R resident t1;
t3:
load evaluate('tablename(' & RecNo & ')') as TableName;
load recno() -1 as RecNo autogenerate nooftables();
which means it worked by a resident load as well as by a preceding but not including recno() - within the evaluate - only recno() will work!
Someone with ideas why it behaved as it behaved?
Thanks for the workaround and in fact this even works like this:
Tab2:
load evaluate('tablename(' & RowNo()-1 & ')') as TableName
autogenerate nooftables();
or
Tab2:
load evaluate('tablename(' & RecNo()-1 & ')') as TableName
autogenerate nooftables();
Idk why and the IterNo() still doesn't work even like this.