Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
robert99
Valued Contributor II

Order By doesn't work


Hope someone can help me on this

I have set up incremental load

But this loads the records in a different order

I tried to rectify this (as I need to do a lastvalue)

So I tried to sort this by various order

None work. I have loaded the script below (Call_Num and FSR_Num are both numeric)

Thanks

left keep (SCCall)
LOAD

FSR_Call_Num as Call_Num,

FSR_Num,

etc
AutoNumber   (TEXT (Upper (FSR_Ser_Num)) & '/' & TEXT (UPPER (FSR_Prod_Num))) as SerialandProdNo,       if (ApplyMap ('RepCodeAdj',FSR_Call_Num,'Missing')='Missing',FSR_Rep_Code,   ApplyMap ('RepCodeAdj',FSR_Call_Num,'Missing')) as RepCode,     


   AutoNumberHash128  ( FSR_Call_Num , FSR_Ser_Num , FSR_Prod_Num) as CallSerial//new  ifNUM( ApplyMap ('WARRENDMAPP',AutoNumber ( TEXT (Upper (FSR_Ser_Num)) & '/' & TEXT (UPPER (FSR_Prod_Num)))  ,'NoCode')) >

  NUM( ApplyMap ('Callindate', FSR_Call_Num  ,'NoCode')) ,'YES','NO') AS CallInWarr

  resident SCFSRTess
where not Match (FSR_Employ_Num, '039') and not match  (FSR_Rep_Code,'09',9)
order by FSR_Call_Num ,FSR_Num          //FSR_Last_Update

;

1 Solution

Accepted Solutions
MVP
MVP

Re: Order By doesn't work

I think you have to resident load your final table (SCCall ?) another time to order it

3 Replies
MVP
MVP

Re: Order By doesn't work

I think you have to resident load your final table (SCCall ?) another time to order it

robert99
Valued Contributor II

Re: Order By doesn't work

Thanks Massimo

I will try when I get to work. I have tried order by a number of times. It works at times but often I have had to find another way of doing what I wanted to.

Its possible that left keep and order by conflicts.

robert99
Valued Contributor II

Re: Order By doesn't work

I eventually used

load

Call_Num,

firstsortvalue (distinct FSR_Call_Num , - FSR_Num) as LastFSRNum

resident   TABLE GROUP BY Call_Num;


This worked and did not need to sort


But I think the answer above (Massimo's) was correct

Community Browser