Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi I have a question,
I have to data source, let's say.
SourceA
SourceA has field like this,
W1 W2 W3 until ........................... W100
........
I want to load data from SourceA without naming each field one by one
is it possible to loop the field name
So it will be
Load
Loop var from 1 to 100
W+var
FROM....
May be try it with RowNo() or RecNo():
LOAD W & RowNo() as SourceA
table:
load null() as n AutoGenerate 0;
for i = 1 to 100
Concatenate(table)
LOAD
'W$(i)' as W$(i) // Remove quotes when loading from your source
autogenerate 1;
next
drop Field n;
Create a variable with the fieldnames:
set vFieldNames='';
for i=1 to 100
let vFieldNames='$(vFieldNames)' & 'W$(i)' & if($(i)<100,',');
next i;
LOAD
$(vFieldNames)
From ...
load Concat(f, ', ', id) as f;
load recno() as id, 'w' & recno() as f AutoGenerate 100;
let v=peek('f');
table:
load $(v)
From somefile;
what is this load null() ... autogenerate and drop Field magic ? .. without it the script is a whole Error?
Please explain...
Thank you!
The purpose is to create a "stub" table so "Concatenate (table)" would not fail in the very first loop step