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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
SingSing16
Contributor III
Contributor III

Nasted IF statement for create filtering button with groups of orders

I have to create  filtering button with groups of orders. It should be called 'Order Type Flag':

FIRST bucket L100','108','120','125','150' should be 'Project Order Types',

SECOND BUCKET: 102','105','103','155,'126,'107,'106','130','110','300' should be called 'Project No-Order Types'

THIRD BUCKET:,'SA','202','201','501','203','600','-','800','500','250','502' should be called 'Project Order Cther Types'

I tried with nasted IF statement as below but it do not works and show me in filter only one bucket.

 

Please support me.

if(match("Order_Type__c",'100','108','120','125','150'),
if(match("Order_Type__c",'102','105','103','155,'126,'107,'106','130','110','300'),
'Project Order Types',
if(match("Order_Type__c",'SA','202','201','501','203','600','-','800','500','250','502'),'Project No-Order Types','Project Order Cther Types'))) as 'Order Type Flag',

Labels (2)
3 Replies
Or
MVP
MVP

That statement doesn't seem to make much sense as it's written. No row is ever going to match the first set of conditions because they're mutually exclusive.

You would want to use:

If(Match(FirstBucketHere),'Bucket1',

If(Match(SecondBucketHere),'Bucket2',

If(Match(ThirdBucketHere),'Bucket3','Others')))

BrunPierre
Partner - Master II
Partner - Master II

Try below.

if(
match("Order_Type__c", '100','108','120','125','150'),
'Project Order Types',
if(
match("Order_Type__c", '102','105','103','155','126','107','106','130','110','300'),
'Project No-Order Types',
if(
match("Order_Type__c", 'SA','202','201','501','203','600','-','800','500','250','502'),
'Project Other Types',
'Other'
)
)
) as [Order Type Flag]

Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

 

The best way to do that is the mapping table and the applymap function.

https://help.qlik.com/en-US/sense/May2023/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptPrefixes/...

https://help.qlik.com/en-US/sense/May2023/Subsystems/Hub/Content/Sense_Hub/Scripting/MappingFunction...

 

Example :

_map:
Mapping Load
  *
Inline [
  Order_Type__c, TypeFlg
  100, Project Order Types
  108, Project Order Types
  102, Project No-Order Types
  502, Project Order Cther Types
];

Load
  *,
  ApplyMap('_map', Order_Type__c, 'Other) as [Order Type Flag]
From file
;
Help users find answers! Don't forget to mark a solution that worked for you!