Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I would like to use a variable as a field in one of the tables.
How can I do that.
Thanks & Regards
e.g.:
let var = 5353;
load $(var) as Value ......
Rgds,
Joachim
Actually I am using the following For statement Statement
FOR EACH file in filelist('C:\Documents and Settings\*.csv*')
Now when I am loading data from each of the files from the given folder I also want the filename as on of the fields but this attempt is giving me some error.
Please note :
FOR EACH file in filelist('C:\Documents and Settings\*.csv*')
TEMP:
LOAD
Field1,
Field2
FROM
[$(file)]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);
but the following code does not work:
FOR EACH file in filelist('C:\Documents and Settings\*.csv*')
TEMP:
LOAD
Field1,
Field2,
$(file) as filename
FROM
[$(file)]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);
Hi,
I am trying to use a variable as a Field.
Here is exactly what I am exactly trying to do:
FOR EACH file in filelist('C:\Documents and Settings\*.csv*') // reads all CSV files in the given folder
TEMP:
LOAD
Field1,
Field2
FROM
[$(file)]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);
NEXT
The above code works fine.
but I also want the the filename as one of the fields and hence I am trying the following code which throws some error.
FOR EACH file in filelist('C:\Documents and Settings\*.csv*')
TEMP:
LOAD
Field1,
Field2,
$(file) as filename
FROM
[$(file)]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);
NEXT
Please let me know that where I am going wrong and how can I meet my objective of having the file name as one of the fields.
Thanks & Regards,
Rohit
Try
'$(file)' as filename