Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi experts!
Is it possible to order a table in the LOAD SCRIPT by a specific field in Qlik Sense?
I have to do that in the load script, because i want to add another filed with sequential numbers there.
Thank you!
Hi Andrea,
The main thing - Order By works only for already loaded tables.
For example,
LOAD
....,
MyField
Resident MyTable
Order By MyField;
Regards,
Andrey
Yes, sure !
It would be sthing like this:
Load
A,
B,
C
from yourTable
ORDER BY A;
Thank you for your reply!
let's say i have something like this:
LOAD
A,
B,
C;
SQL SELECT A,
B,
C
FROM .....
I would like to order the table by the field "A", and only when ordered add the rowno() in the load script. Could you please provide me an example of code?
Thank you
Thank you for your reply!
let's say i have something like this:
LOAD
A,
B,
C;
SQL SELECT A,
B,
C
FROM .....
I would like to order the table by the field "A", and only when ordered add the rowno() in the load script. Could you please provide me an example of code?
Thank you
load *, rowNo() as RowNo;
LOAD
A,
B,
C
Order By A;
SQL SELECT A,
B,
C
FROM .....
Thank you again Omar! I've not been that clear sorry
the code does not work, it displayed the error: field " " not found.
the fact is taht i would like to order the entire table by a Date Filed (recent first), then assign a rowno() to the table (lower number --> more recent dates).
Please help me! Thank you!
Can you paste your code and an image of the shown error?
this is the code:
LIB CONNECT TO 'XXX';
load *, rowNo() as RowNo;
LOAD id,
oKey,
pId as PID,
RDate,
RDate&': '&oKey&id&pId as IDconcat,
order by IDconcat
;
SQL SELECT id,
oKey,
pId,
RDate
FROM "XXX_xxx".dbo."XXXABC"
WHERE YEAR(RDATE)>YEAR(GETDATE())-3
;
this is the error:
the fact is that i want to first order the table by the IDconcat, then add rowno().
Thankyou!!
Hi Andrea,
As variant,
Table1:
LOAD
A,
B,
C
FROM....;
NoConcatenate
Table2:
LOAD*
Resident Table1
Order By A;
DROP Table Table1;
I'll note again, Order By works only with resident (internal) tables. Sort immediately during download from the database SQL will not work.
Regards,
Andrey