Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Mattia
Creator II
Creator II

Is there something wrong in this expression?

Hi QV users,

i'am writing an expression like the following, but it not works:

If([field1]='not null', If([field2]=030357,'output1','output2')

My goals is to create a new field that show me:

a) output1, if field1 is not null and field2 = 030357

b) output2, if field1 is not null and field2 <> 030357

Is there something wrong?

Thanks,

Mattia

1 Solution

Accepted Solutions
sunny_talwar

May be this

If(Len(Trim([field1])) > 0,
  If([field2] = '030357', 'output1', 'output2')
)

View solution in original post

6 Replies
Frank_Hartmann
Master II
Master II

can u share the rawdata?

Mattia
Creator II
Creator II
Author

Sorry Frank, i can't do this now.

Can you help me anyway?

Thanks,

Mattia

Stoyan_Terziev
Partner - Creator III
Partner - Creator III

Hi Mattia,

 

Please give this one a try:

IF(NOT IsNull([field1]) AND [field2]=030357, 'output1',

IF(NOT IsNull([field1]) AND [field2]<>030357, 'output2', 'output3') )as Output

There needs to be a third output there though. Because there are more than just those 2 options in your equation -> ex: When [field1] is Null

 

I hope that helps!

Regards,

S.T.

Mattia
Creator II
Creator II
Author

Hi Stoyan!

is it possible to have an expression that shows only two options?

Thanks,

Mattia

sunny_talwar

May be this

If(Len(Trim([field1])) > 0,
  If([field2] = '030357', 'output1', 'output2')
)
Mattia
Creator II
Creator II
Author

Thanks Sunny!

It works perfectly!!!

Mattia