Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Input table:
| DocId | Status |
| 100 | New |
| 100 | Processed |
| 100 | QCError |
| 101 | QCCompleted |
| 101 | Processed |
| 200 | New |
| 200 | Processed |
| 200 | QCCompleted |
| 300 | New |
| 100 | Processed |
| 300 | Processed |
| 400 | Processed |
| 300 | Processed |
| 100 | Processed |
| 400 | QCError |
------------------
Expected output table:
| DocId | Status | Flag |
| 100 | New | 2 |
| 100 | Processed | 1 |
| 100 | QCError | 2 |
| 101 | QCCompleted | 2 |
| 101 | Processed | 1 |
| 200 | New | 2 |
| 200 | Processed | 1 |
| 200 | QCCompleted | 2 |
| 300 | New | 2 |
| 100 | Processed | 2 |
| 300 | Processed | 1 |
| 400 | Processed | 1 |
| 300 | Processed | 2 |
| 100 | Processed | 2 |
| 400 | QCError | 2 |
Note(The above output):If First time the record(DocId with status='Processed') entered into output table then flag should be placed as 1 else 2 or 0,
even the same DocId placed seconde time in output table the flage should be 2 or 0.
any help on above
Hi,
one possible solution:
LOAD *,
If(Status='Processed', NumMin(AutoNumber(RecNo(),DocId&Status),2),2) as Flag
FROM [http://community.qlik.com/thread/130525] (html, codepage is 1252, embedded labels, table is @1);

hope this helps
regards
Marco
Hi
Try like this
Load
If(Previous(DocID) <> DocID, 1, 2) as Flag
resident tablename
order by DocID;
Hi,
Try this:
LOAD *,if(AutoNumber(RollNum,DocId)>2,2,AutoNumber(RollNum,DocId)) as flag Inline
[
DocId, RollNum
100, 101
100 ,102
101 ,103
200 ,201
200 ,202
300 ,301
100 ,401
300 ,501
400 ,201
300 ,601
100 ,101
400 ,401
];
HTH
Sushil
Hi Shiva,
Try like this
LOAD
*,
If(Previous(DocID) <> DocID, 1, 2) as Flag;
Load
*
Resident DataSource;
Order By DocID;
Hope this helps you.
Regards,
Jagan.
Just use autonumber(RollNum, DocId)
Hi,
one possible solution:
LOAD *,
If(Status='Processed', NumMin(AutoNumber(RecNo(),DocId&Status),2),2) as Flag
FROM [http://community.qlik.com/thread/130525] (html, codepage is 1252, embedded labels, table is @1);

hope this helps
regards
Marco