Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

If condition giving incorrect result

Hey Guys,

I am writing below logic so that when status is not equal to 3 or 4 it should display Unprocessed else Processed.

if ([statut] <>'3'  or '4', 'Unprocessed', 'Processed')  as Flag

But in qlikview after I write the above condition, I get Unprocessed if Status=3, which is wrong according to this above logic.

Can you please help me with the above issue?whether my calculation wrong?

7 Replies
keerthika
Creator II
Creator II

Hi ,

    Try this =if(wildmatch(status,'3','4')>=1,'Processed','Unprocessed')

tresesco
MVP
MVP

May be this?

if ( Not Match ([statut], '3', '4'), 'Unprocessed', 'Processed')  as Flag

gayathri_nagara
Contributor II
Contributor II

Hi,

Check this whether it is useful

status:

LOAD * INLINE [

    Status

    1

    2

    3

    4

    5

    6

    7

    8

    9

];

load *,

if(Status = '3' or Status = '4', 'UnProcessed')  as Flag

Resident status;

load *,

if(Status <> '3' or Status <> '4', 'Processed')  as Flag

Resident status;

ashwin_r
Contributor III
Contributor III

Try this,


if ([status] <>3  or [status]<>4, 'Unprocessed', 'Processed')  as Flag

dapostolopoylos
Creator III
Creator III

Try:

=if(Match(status,'3','4'),'Processed','Unprocessed')

Father/Husband/BI Developer
olivierrobin
Specialist III
Specialist III

hello

due to operator precedence, your formula is equivalent to

[statut] <>('3'  or '4')

try with match function for example

tresesco
MVP
MVP

Hi Olivier,

Olivier Robin wrote:

hello

due to operator precedence, your formula is equivalent to

[statut] <>('3'  or '4')

try with match function for example

I guess that's not correct. In fact,

if ([statut] <>'3'  or '4'

is being evaluated as: if ( ([statut] <>'3')  or '4' ..........., i.e it is evaluating two separate conditions, one for [statut]<>'3'  and second one just '4', which is actually TRUE always (any number except '0' is 'true'). Therefore, the condition effectively becomes :  if ( ([statut] <>'3')  or TRUE() , ... I.e. - 'something OR TRUE' - which would always return a TRUE.