Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to use IN operator in Qlikview

hi,

actually i had a table in which i got various order values but i want to display only those orders which are 24,26, & 27.

In Sql we can use IN operator for that.

Please help me here how to use it.

Thanks

12 Replies
rajni_batra
Specialist
Specialist

=if(match(Order,24,25,26),Order or any other value)

Not applicable
Author

Hi Rajni,

Upto If(Match(order,24,25,26)   i got to know but after that  'Order or any other value'....wat is dat???

rajni_batra
Specialist
Specialist

means u want to display only orders then use orders if in case u want to display something else for respective these order no. then u can use the same

like if u want to show sales office for  these orders then use

if(match(Order,24,25,26),Sales Office)

Hope it would be helpful!!!

Not applicable
Author

Hi Rajni,

Thanks for your quick response but there is a problem after i am implementing this logic.

   I had the order table data as

   Order Id                                                                          Order ID

    24                                                                                         25

    25                                                                                         26

    26                                                                                          27

    27

    28                              

    29                                  needed output -->  

Now as per your logic : In expression   :

    If(match(orderId,25,26,27),OrderId)

Now what is happening ,In the report where the order id id dispayed ...the output is coming like this..

OrderID

24

25 - 25

26- 26

27- 27

28

29

I dont know the reason..please throw some light

rajni_batra
Specialist
Specialist

may i know where did u put this expression??

if u are using it in a report so better use this as dimension in ur table or using some other Object??

jaime_aguilar
Partner - Contributor III
Partner - Contributor III

You can use a resident table for displaying the desired Order IDs:

ORDERS:

LOAD * INLINE [

    OrderID

    24

    25

    26

    27

    28

    29

];

MATCH:

load *,

if(match(OrderID, 25,26,27), OrderID) as output

Resident ORDERS;

Not applicable
Author

This depends on where you want to include the in values.  If it is just in a text object or display object then using:

=if(Match(Order,24,26,27),Order)

But if you want to create an expression and only want the values of those 3 orders used in that expression then you would use set analysis in the expression like this:

sum({<Order={'24','26','27'}>}(TotalSales))

Hope this helps!

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

QlikView has a function called EXISTS. May be worth trying it.

EXISTS( field [ , expr ] )

Determines whether a specific field value exists in a specified field

of the data loaded so far. Field is a name or a string expression evaluating

to a field name. The field must exist in the data loaded so far

by the script. Expr is an expression evaluating to the field value to

look for in the specified field. If omitted, the current record’s value

in the specified field will be assumed.

Examples:

EXISTS( Month, 'Jan' )

returns -1 (true) if the field value Jan can be found in the

current contents of the field Month.

Regards

Not applicable
Author

You need to specify.. where you want to use the values.. as expression or dimension. lo_arron has already answered it. If you could clarify it. we can try and get back to you soon.  OR you can share the application and requirement, we will surely try helping you.