Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have a csv file with a specific field like this:
TYPE
AT IT BA
IT BA
AT BA LB
RT LB
I want to create something like:
TYPE OPTION1 OPTION2 OPTION3
AT IT IT BA
IT BA
AT BA LB
RT LB
How i can do it?
Thanks!
with subfield function
X:
LOAD
subfield(TYPE, ' ', 1) as TYPE,
subfield(TYPE, ' ', 2) as OPTION1,
subfield(TYPE, ' ', 3) as OPTION2,
subfield(TYPE, ' ', 4) as OPTION3
FROM a.csv
(txt, codepage is 1252, embedded labels, delimiter is ';', msq);
subfield also works in chart
I think when you load CSV you are able to specify the delimiter. Have you tried to specify <space> as your delimiter?
try
LOAD @1 as TYPE, @2 as OPTION1, @3 as OPTION2, @4 as OPTION3
FROM yourfile.csv
(txt, codepage is 1252, no labels, delimiter is spaces, msq, header is 1 lines);
Thanks! Some way to do without using the load statement?
Regards.
If not, my file has a lot of columns, how i can adjust the load script to only split the desired column?
Regards.
with subfield function
X:
LOAD
subfield(TYPE, ' ', 1) as TYPE,
subfield(TYPE, ' ', 2) as OPTION1,
subfield(TYPE, ' ', 3) as OPTION2,
subfield(TYPE, ' ', 4) as OPTION3
FROM a.csv
(txt, codepage is 1252, embedded labels, delimiter is ';', msq);
subfield also works in chart