Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If statement error

I have created scripting error where my statement is IF(EvType= 15 AND EvParam1 > Lookup('SystemResponseTime','%MailBoxID',EvMailBoxID,'MailBox'), 'Not met Service Level', 'Met Service Level' ) AS ServiceEventLevelStatus, well you can imagine the part not Met Service level is correct however, For met service level I only want it so that IF(EvType= 15 AND EvParam1

1 Solution

Accepted Solutions
Not applicable
Author

I got it and it was my mistake this is what I wanted  My apoligies for the confusion

IF(EvType= 15, IF (EvParam1 > Lookup('SystemResponseTime','%MailBoxID',EvMailBoxID,'MailBox'), 'Not met Service Level', 'Met Service Level')) AS ServiceSLA,

View solution in original post

21 Replies
Not applicable
Author

I understand it is doing an else for all evTypes, I just need it for evType 15. Thank You in advance.

Greg_Williams
Former Employee
Former Employee

Is "15" a number or text? Table Viewer window > highlight over field > text or int/num? All is spelled correctly (case sensitive)? Perhaps use ( ) parenthesis to control the logic block.

Not applicable
Author

Number
tinyint to be exact in the db

Not applicable
Author

trying it but don't know where to block it up getting errors all around

Not applicable
Author

I need to do it only for evtype 15 not the other evtypes, current with this statement IF(EvType= 15 AND EvParam1 > Lookup('SystemResponseTime','%MailBoxID',EvMailBoxID,'MailBox'), 'Not met Service Level', 'Met Service Level' ) AS ServiceEventLevelStatus,

I am getting the correct results for 'Not met Service level"  but for met Service level it is showing that for all evTypes , However I just need it for evType 15

Greg_Williams
Former Employee
Former Employee

Just for clarification...

IF(EvType= 15 AND EvParam1 > Lookup('SystemResponseTime','%MailBoxID',EvMailBoxID,'MailBox'), 'Not met Service Level', 'Met Service Level' )


Translates to:

if

EvType = 15

AND

EvParam1 > "some number"

if True => 'Not met Service'

if False => 'Met Service level'

*** if no value found in Lookup - the value is Null.

Have you done a simple test of your Lookup logic to make sure that works alone (without If)?

Can try if( (EvType=15) AND (EvParam1>Lookup()), true, false

Not applicable
Author

nope no null values, however if I switch the operators then it is still correct Current My express Translates to: if EvType = 15 AND EvParam1 > "some number" if True => 'Not met Service' if False => 'Met Service level' However I want it to show Translates to: if EvType = 15 AND EvParam1 > "some number" if True => 'Not met Service' if False => EvType = 15 AND EvParam1 > "some number"

Not applicable
Author

= ' Met service level '

Greg_Williams
Former Employee
Former Employee

Your False logic is including EvTypes other than 15, even though you specified that logic in the If clause?

Perhaps consider using: an inline table or use 0 and 1 to test logic successfully, or use set analysis for the expression instead.