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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
satish25
Creator
Creator

Selection for IF Clause

Hello Everyone,

I have the Following table:

Factory_Code

1002

1005
4001
4002
5001
5009
6113
7004
8001
8008
9000
9001

The expresssion is as follows:

If(WildMatch(Factory_Code,'4*'),'Exclude service center',

If(Factory_Code='5001' or

        Factory_Code= '9001' or

            Factory_Code='8001' or

                Factory_Code='1005' or

                    Factory_Code='8008','Exclude HO',

If(WildMatch(Factory_Code,'*'),'Standard'))) as Factory_Section.

In this code, I want the third condition to display all the Factory_Codes (i.e. it should include the values of 'Exclude service center' and 'Exclude HO' as well)

The Output should be as follows:

  • Exclude service center = 4001,4002.
  • Exclude HO = 5001, 8001,9001, 1005,8008.
  • Standard = 1002, 1005, 4001, 4002, 5001, 5009, 6113, 7004, 8001, 8008, 9000, 9001.


However in Future, the Factory_Codes may increase or decrease.

So wanted the necessary changes to be made in the Code.


Thanks in Advance.

1 Solution

Accepted Solutions
agigliotti
MVP
MVP

you can do it with the below script:

load

    Factory_Code,

If(WildMatch(Factory_Code,'4*'),'Exclude service center',

If(Factory_Code='5001' or

        Factory_Code= '9001' or

            Factory_Code='8001' or

                Factory_Code='1005' or

                    Factory_Code='8008','Exclude HO' )) as Factory_Section

from your_table;

concatenate

load

     Factory_Code,

     'Standard' as Factory_Section

from your_table;

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it

View solution in original post

5 Replies
agigliotti
MVP
MVP

why do you need the third condition ?

what's your desired result on UI ?

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
satish25
Creator
Creator
Author

I know that No selections with give all the Factory_Codes, but i want it to happen on the 'Standard' selection.

Basically that's a requirement I need to fulfil.

agigliotti
MVP
MVP

you can do it with the below script:

load

    Factory_Code,

If(WildMatch(Factory_Code,'4*'),'Exclude service center',

If(Factory_Code='5001' or

        Factory_Code= '9001' or

            Factory_Code='8001' or

                Factory_Code='1005' or

                    Factory_Code='8008','Exclude HO' )) as Factory_Section

from your_table;

concatenate

load

     Factory_Code,

     'Standard' as Factory_Section

from your_table;

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
satish25
Creator
Creator
Author

This works perfectly,

Thank you ..!!

OmarBenSalem
Partner - Champion II
Partner - Champion II

Then please close the thread by marking the correct answer as correct