Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Jorich919
Contributor III
Contributor III

Question about comparison operators

Can someone please tell me when to use -= for "not equal to" and when to use <> instead?  I keep getting this mixed up. Is there a cheat sheet for these types of syntax snafus?

Thanks!!

1 Solution

Accepted Solutions
prabhu0505
Specialist
Specialist

-= Exclude a value or set of values from a particular field in set analysis

<> works in expressions, load script but cannot be used in set analysis 

View solution in original post

6 Replies
Vegar
MVP
MVP

Use -= in SET analysis when declaring fieldvalues to exclude

Sum({$<Year -= {'2019'}>}Amount)

 

For everything else you use <>

prabhu0505
Specialist
Specialist

-= Exclude a value or set of values from a particular field in set analysis

<> works in expressions, load script but cannot be used in set analysis 

Jorich919
Contributor III
Contributor III
Author

Ah ha!! I think I'm getting this. 

So I would use <> in an IF statement??

prabhu0505
Specialist
Specialist

yes you can use it in if statement of expression and load statement

Vegar
MVP
MVP

Yes in an IF statement you would use IF.

 

Eg.

IF 1<>2 THEN
  LOAD 
    *,
    IF(Date<>today(), 'Not today', 'Today') as TodayFlag 
  FROM 
    DaTa;
END IF

 

Jorich919
Contributor III
Contributor III
Author

Got it! Thanks to both of you!!