Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
bimanbeginner
Contributor II
Contributor II

If statement

Hi There.

Im trying to write an if statement that doesnt seem to be working

I have a field Name

I want to create a new field which defines these Names.

in this field I want Closed,Open and All

I have tried below:

if( Name='Closed','Closed',

If(Name<>'Closed','Active')) as FieldName

This works to get my closed and active steps, how do i get all in the same statement?

FYI :I have many names in this field

Thank You

1 Solution

Accepted Solutions
tresesco
MVP
MVP

It seems that you need something like generic field.

Untitled.png

If so, try like:

t1:

Load * Inline [

Status

Closed

ABC

BCD

Not Closed

Opennn

];

t2:

Load

       'All' as GenericStatus,

       Status

Resident t1;

t2:

Load

       Status as GenericStatus,

       Status

Resident t1 where Status='Closed';

Load

       'Open' as GenericStatus,

       Status

Resident t1 where Status<>'Closed';

View solution in original post

13 Replies
MK_QSL
MVP
MVP

As I understood from your post,

Any name having 'Closed' word, you want to declare as Closed.

What are the criteria for All and Active?

Anil_Babu_Samineni

May be this?

If(Name = 'Closed', 'Closed', If(Name = 'Open', 'Open', 'All')) as FieldName

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

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)
ahaahaaha
Partner - Master
Partner - Master

Hi

Try

if( Name='Closed','Closed','Active') as FieldName

bimanbeginner
Contributor II
Contributor II
Author

Everything with closed will be closed everything else is still active.

but the user must be able to distinguish between closed active and both by selecting one in a list box...

bimanbeginner
Contributor II
Contributor II
Author

There is no field defining open names... but the logic is that if it is not closed... then it is open.. or active...

bimanbeginner
Contributor II
Contributor II
Author

Hi Andrey... what about all though?

Anil_Babu_Samineni

If you don't have field name called Name. Then how you are calculating? May be check one funny solution with ValueList() ?? If not i may not understand the rek

FYI - My expression may give make sense if you have field called Name

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

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)
bimanbeginner
Contributor II
Contributor II
Author

Sorry i think i havent explained correctly.

The field Name does exist, but there is a name called closed which identifies all closed items all other items will be open hence me using <> to closed in my initial expression... There is no name = 'Open'  the logic is that if it is not closed then it is open

PrashantSangle

Can be more specific. Better with example.

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂