Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
Could you tell me if possible to load csv file with order by?
Thanks,
I think order can only be controlled after loading the file into QV, like below or may be other ways but it has to be loaded first so that QV functions can work -
Table1:
LOAD Country,
Customer,
Sales
FROM
Data.csv
(txt, utf8, embedded labels, delimiter is ',', msq);
NoConcatenate
Output:
Load * Resident Table1 Order By Sales Desc;
Drop Table Table1;
I think order can only be controlled after loading the file into QV, like below or may be other ways but it has to be loaded first so that QV functions can work -
Table1:
LOAD Country,
Customer,
Sales
FROM
Data.csv
(txt, utf8, embedded labels, delimiter is ',', msq);
NoConcatenate
Output:
Load * Resident Table1 Order By Sales Desc;
Drop Table Table1;
I did like you suggested.
In 1 table it's not doable
Thanks,
Vladimir,
Not posible, "order by" function is only executable in resident table.
Regards.
Thank you for confirming
Yup, found few similar questions but don't see any direct option of loading and sorting in one go.
"order by is a clause used for sorting the records of a resident table before they are processed by the load statement. The resident table can be sorted by one or more fields in ascending or descending order. " References Manual 11.2 SR12 - Page 255.
You can use a precedent load
Table1:
LOAD Country,
Customer,
Sales
Order By Sales Desc;
LOAD Country,
Customer,
Sales
FROM
Data.csv
(txt, utf8, embedded labels, delimiter is ',', msq);
Clever,
You are sure? I understand with precedent load only use function "Where, While and Group By"
Regards.
Something is wrong. I need to add autonumber based on my sort.
CSV:
LOAD AutoNumber(TimeStamp) as Auto_Id,
SessionID,
Url,
TimeStamp,
ValidData
ORDER BY SessionId, [TimeStamp] ASC;
LOAD AutoNumber(TimeStamp) as Auto_Id,
SessionID as SessionId,
Url,
TimeStamp,
ValidData
FROM
(txt, codepage is 1251, embedded labels, delimiter is ',', msq)
where match(SessionID,$(vValue));