Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Not applicable

Extract on some lines from a table

Hello everyone,

During the script, if I have a table like:

IDRec, IdPers, DataIscr, DataCanc

1 1 01/01/2010 01/03/2010
2 1 01/06/2010
3 2 11/01/2010 21/03/2010
4 3 11/03/2010
5 5 21/01/2011

How can I make the script to extract only one line for each
IdPers, and where there are multiple lines with
the same IdPers value (see IdPers = 1) extract

only the row DataCanc = null?


Thanks to all and hello

2 Replies
prieper
Honored Contributor II

Extract on some lines from a table

Give it a try with the below:

RawData:
LOAD * INLINE [
IDRec, IdPers, DataIscr, DataCanc

1, 1, 01/01/2010, 01/03/2010
2, 1, 01/06/2010
3, 2, 11/01/2010, 21/03/2010
4, 3, 11/03/2010
5, 5, 21/01/2011];

Data:
NOCONCATENATE LOAD
*
RESIDENT
RawData
WHERE
IdPers <> PREVIOUS(IdPers)
ORDER BY
IDRec DESC;

DROP TABLE RawData;


HTH
Peter

Not applicable

Extract on some lines from a table

Thank Peter, very much.

But why don't I can use an expressin like:

Load *

,firstsortedvalue(dataCanc, -1) as DataCanc2

group by IdPers;

?

Thank All