Skip to main content
Announcements
See why Qlik was named a Leader in the 2024 Gartner® Magic Quadrant™ for Data Integration Tools for the ninth year in a row: Get the report
cancel
Showing results for 
Search instead for 
Did you mean: 
alejortizp
Contributor III
Contributor III

How can i use where in the load?

Hi,

Im trying to filter since load with the argument when for just load the lines with 'VIGENTE', but i dont know how use it. This is my sentence:

TablaUnidistintos:

LOAD *,

if("Num CCOBRO"=Previous("Num CCOBRO"),if(ESTADO<Previous(ESTADO),'VIGENTE','NO VIGENTE'),'VIGENTE') as VIGENTE

Resident tablaUnifOrdenada

Where VIGENTE='VIGENTE';

Thanks if you give me a light

Labels (1)
2 Replies
Jesh19
Creator II
Creator II

Try the change in where condition

TablaUnidistintos:

LOAD *,

if("Num CCOBRO"=Previous("Num CCOBRO"),if(ESTADO<Previous(ESTADO),'VIGENTE','NO VIGENTE'),'VIGENTE') as VIGENTE

Resident tablaUnifOrdenada

Where if("Num CCOBRO"=Previous("Num CCOBRO"),if(ESTADO<Previous(ESTADO),'VIGENTE','NO VIGENTE'),'VIGENTE') ='VIGENTE';

swuehl
MVP
MVP

The field VIGENTE is created in your LOAD, it's not part of your input table, so you can't use it as field in your WHERE clause.

But you can use a preceding LOAD that operates on the following LOAD statement, hence VIGENTE is available for filtering:

TablaUnidistintos:

LOAD *

WHERE VIGENTE = 'VIGENTE';

LOAD *,

if("Num CCOBRO"=Previous("Num CCOBRO"),if(ESTADO<Previous(ESTADO),'VIGENTE','NO VIGENTE'),'VIGENTE') as VIGENTE

Resident tablaUnifOrdenada;