Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Creating Multiple Account Flags

Table:

Load * inline

[

ID, Type

1, A

1, B

2, A

2, B

2, E

3, D

3, B

3, C

];

FlagTable:

LOAD ID,

1 as Flag1,

    IF(MATCH(UPPER(Type), 'A'), 1) as Flag2,

    IF(MATCH(UPPER(Type), 'B', 'C'),  1) as Flag3

RESIDENT Table;

DROP TABLE Table;

EXIT SCRIPT;

Getting:

Qlik.PNG

WANT:

 

IDFlag1Flag2Flag3
1111
2111
311

Any suggestions?

1 Solution

Accepted Solutions
OmarBenSalem

FlagTable:

load max(Flag3) as Flag3 , max(Flag1) as Flag1, max(Flag2) as Flag2 , ID group by ID;

LOAD ID,

1 as Flag1,

    IF(MATCH(UPPER(Type), 'A'), 1) as Flag2,

    IF(MATCH(UPPER(Type), 'B', 'C'),  1) as Flag3

RESIDENT Table;

DROP TABLE Table;

EXIT SCRIPT;

View solution in original post

2 Replies
OmarBenSalem

FlagTable:

load max(Flag3) as Flag3 , max(Flag1) as Flag1, max(Flag2) as Flag2 , ID group by ID;

LOAD ID,

1 as Flag1,

    IF(MATCH(UPPER(Type), 'A'), 1) as Flag2,

    IF(MATCH(UPPER(Type), 'B', 'C'),  1) as Flag3

RESIDENT Table;

DROP TABLE Table;

EXIT SCRIPT;

OmarBenSalem

result:

Capture.PNG