Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikwiz123
Creator III
Creator III

Create a Flag in Script based on Condition

I have data in the following way

 

ID        CatID      Status               Flag   (Expected Field)

1           1A          Pending            Complete/Pending

1            1B         Complete         Complete/Pending

2            2A          Complete         Complete

3            3A          Pending             Pending

3            3B           Pending            Pending

3           3C            Pending             Pending

4            4A            Complete          Complete

5             5A           Pending          Complete/Pending

5              5B           Complete      Complete/Pending

 

I need to create a new field called 'Flag' that says 'Complete/Pending' for the IDs that has both 'Pending' and 'Complete' in Status. If the ID has only one value in the Status field, then show the same Status value in the 'Flag'

How do I do this in the script?

 

Labels (2)
1 Solution

Accepted Solutions
Marcos_rv
Creator II
Creator II

Try this :

TABLE1:

LOAD ID, 

CatID,

Status

from XXXXX.QVD;

LEFT JOIN (TABLE1)

load ID,

Concat(distinct Status ,'-' ) as Flag

resident TABLE1;

 

Saludos!!!

View solution in original post

5 Replies
Marcos_rv
Creator II
Creator II

Try this :

TABLE1:

LOAD ID, 

CatID,

Status

from XXXXX.QVD;

LEFT JOIN (TABLE1)

load ID,

Concat(distinct Status ,'-' ) as Flag

resident TABLE1;

 

Saludos!!!

qlikwiz123
Creator III
Creator III
Author

Says Invalid Expression

qlikwiz123
Creator III
Creator III
Author

Needed to Group By. Will try. Thanks

Anil_Babu_Samineni

PFA

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Marcos_rv
Creator II
Creator II

yep, 

group by ID;

 

Very close !! jajaja