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!
Try this:
LIB CONNECT TO 'XXX';
load *, rowNo() as RowNo;
LOAD*
order by IDconcat
;
LOAD id,
oKey,
pId as PID,
RDate,
RDate&': '&oKey&id&pId as IDconcat,
;
SQL SELECT id,
oKey,
pId,
RDate
FROM "XXX_xxx".dbo."XXXABC"
WHERE YEAR(RDATE)>YEAR(GETDATE())-3
Hi Andrea,
Sorry for getting involved with Omar proposed solution, but if you are getting the data from a database, like Oracle, MS Sql Server, or other vendor supporting Views, you could create the query at the database as a view with the required sorting, it could be more efficient if the back-end database does the job instead of Qlik.
Be aware your idea could back-fire, because Record-X could get a different rowNo() everyday (if re-creating the QVD every day, or the same rowNo() assigned to multiple records if you implemented an incremental QVD creation)
HTH
How about this
LOAD id,
oKey,
pId as PID,
RDate,
RDate&': '&oKey&id&pId as IDconcat,
RowNo() as RowNum
;
SQL SELECT id,
oKey,
pId,
RDate
FROM "XXX_xxx".dbo."XXXABC"
WHERE YEAR(RDATE)>YEAR(GETDATE())-3
ORDER BY id,oKey,pId,RDate;