Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Order By within Preceding Load

I'm building a flag with a script that will compare the previous record to the current and flag differences. My current script is in the form of:

LOAD *, If(Previous(B) = B, 0, 1) as flag;

LOAD *

Order By C;

LOAD A, B, {expression} as C

RESIDENT Data;

You'll likely suggest I put the Order By within the bottom LOAD, but the multiple preceding LOADs are actually more complicated than what's represented here. For this discussion, I'd like to know if I can get the above to work.

The error states I'm missing a "FROM" syntax, suggesting you need a FROM for the Order By to work.

1 Solution

Accepted Solutions
MVP
MVP

Order By within Preceding Load

I believe you cannot use an order by in a preceding load.  I believe you will need to handle it with a second load, either creating a new table or doing a left join on the key.  So first create field C, then do another load resident.

3 Replies
MVP
MVP

Order By within Preceding Load

I believe you cannot use an order by in a preceding load.  I believe you will need to handle it with a second load, either creating a new table or doing a left join on the key.  So first create field C, then do another load resident.

Not applicable

Order By within Preceding Load

I'm thinking it's not possible either. I ended up creating a new table to deal with this. I was afraid that it would add load time or memory usage, but it doesn't seem to be the case even working with several million records.

Not applicable

Re: Order By within Preceding Load

I'm thinking it's not possible either. I ended up creating a new table to deal with this. I was afraid that it would add load time or memory usage, but it doesn't seem to be the case even working with several million records.

Community Browser