Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I have the next script but when I refresh I'm not able to create the table name so in the concat function I got the error in the final image.
Where should I put the name? Or should I use a function to do so?
Let vNumeroPagina=1;
do while vValorFinal>2
[VentasDiarias]:
LOAD
Período
FROM [XXXXX]
(html, codepage is 1252, embedded labels, table is @$(vNumeroPagina));
Let vValorFinal=len(peek('Período',-2,'VentasDiarias'));
Let vNumeroPagina=$(vNumeroPagina)+1;
Loop
Concatenate (VentasDiarias)
LOAD
Período
FROM [xxxxxxx]
(ooxml, embedded labels, table is Sheet1);
Drop Table;
My guess is that it is not going into the loop at all as you are not initialising vValorFinal and it is not getting set until inside the loop.
Ahead of the code you have, try adding:
let vValorFinal = 9999;
If you have a load and you are not sure whether a table exists before you concatenate to it you can always create a dummy table:
MyTable:
LOAD
null() as tmpDummy
AUTOGENERATE(1);
Then at the end:
DROP FIELD tmpDummy;
This should create a table stub that can then be concatenated to. It's a bit of a cheat, but it works.
A neater, but fiddlier, alternative is to do the table name in a variable:
let vTabName = if(alt(NoOfRows('MyTable'), 0) > 0, 'CONCATENATE (MyTable)', 'MyTable:');
$(vTabName)
LOAD
... etc ...
Hope that helps.
Steve
I feel on the first run the initial table is not created or loaded with zero records before the concatenation statement is executed , could you please share the complete log file ?
My guess is that it is not going into the loop at all as you are not initialising vValorFinal and it is not getting set until inside the loop.
Ahead of the code you have, try adding:
let vValorFinal = 9999;
If you have a load and you are not sure whether a table exists before you concatenate to it you can always create a dummy table:
MyTable:
LOAD
null() as tmpDummy
AUTOGENERATE(1);
Then at the end:
DROP FIELD tmpDummy;
This should create a table stub that can then be concatenated to. It's a bit of a cheat, but it works.
A neater, but fiddlier, alternative is to do the table name in a variable:
let vTabName = if(alt(NoOfRows('MyTable'), 0) > 0, 'CONCATENATE (MyTable)', 'MyTable:');
$(vTabName)
LOAD
... etc ...
Hope that helps.
Steve
The drop field worked perfectly