Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Everyone,
I am wating to create a set statement that pulls information from an external text file in the load script.
So rather than:
Set x='May, June, July'
I want the 'May, June, July' to come from a text file stored locally.
Is this possible?
Thanks
Gareth
Hello Gareth,
I'd do a concatenated load of all possible values in your text file (one value per file in the text file), using the code as
ValuesTemp:
LOAD Chr(39) & Concat(Value, Chr(39 & Chr(44) & Chr(39)) & Chr(39) AS AllValues
FROM File.txt (txt, utf8, embedded labels, delimiter is '\t', msq);
LET vVariable = FieldValue('AllValues', 1);
DROP TABLE ValuesTemp;
The file is called file.txt and it has only one field named "Value". It takes more work than hardcoding the values but it may worth doing this to have a greater control in an external file.
Hope that helps.
BI Consultant
Hello Gareth,
I'd do a concatenated load of all possible values in your text file (one value per file in the text file), using the code as
ValuesTemp:
LOAD Chr(39) & Concat(Value, Chr(39 & Chr(44) & Chr(39)) & Chr(39) AS AllValues
FROM File.txt (txt, utf8, embedded labels, delimiter is '\t', msq);
LET vVariable = FieldValue('AllValues', 1);
DROP TABLE ValuesTemp;
The file is called file.txt and it has only one field named "Value". It takes more work than hardcoding the values but it may worth doing this to have a greater control in an external file.
Hope that helps.
BI Consultant
hello
please find the attached .use text file instead of excel.
change the code accodingly will give u desired result.