Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

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
Highlighted
Creator II
Creator II

Re: Create a Flag in Script based on Condition

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
Highlighted
Creator II
Creator II

Re: Create a Flag in Script based on Condition

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

Highlighted
Creator II
Creator II

Re: Create a Flag in Script based on Condition

Says Invalid Expression

Highlighted
Creator II
Creator II

Re: Create a Flag in Script based on Condition

Needed to Group By. Will try. Thanks

Highlighted

Re: Create a Flag in Script based on Condition

PFA

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Highlighted
Creator II
Creator II

Re: Create a Flag in Script based on Condition

yep, 

group by ID;

 

Very close !! jajaja