Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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

Tags (2)
1 Solution

Accepted Solutions
Not applicable

Re: If statement error

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,

21 Replies
Not applicable

Re: If statement error

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

Employee
Employee

Re: If statement error

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

Re: If statement error

Number
tinyint to be exact in the db

Not applicable

Re: If statement error

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

Not applicable

Re: If statement error

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

Employee
Employee

Re: If statement error

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

Re: If statement error

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

Re: If statement error

= ' Met service level '

Employee
Employee

Re: If statement error

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.

Community Browser