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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

if statement problem

hi gurus,

i have field unit

Unit
USA
CANADA
CHINA
JAPAN
INDIA

    1. a. Operational Americas: Operating units – Only (USA , Canada )
    2. b. Operational International: Operating units – Not (USA, Canada, China , Japan)
    3. c. Operational Global: Operating Units – Not (China, Japan)
  1. how to achieve this in list box

Thanks in advance

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Create a new field Operational Group. Add this to the script:

Operational_Groups:

LOAD * INLINE [

Operational Group, Unit

Operational Americas, USA

Operational Americas, CANADA

Operational International, INDIA

Operational Global, USA

Operational Global, CANADA

Operational Global, INDIA

];


Reload the document.


Add a listbox with the new field Operational Group.


talk is cheap, supply exceeds demand

View solution in original post

9 Replies
anbu1984
Master III
Master III

Can you explain your requirement and post expected output in Listbox

Anonymous
Not applicable
Author

Unit
Operational Americas
Operational International
Operational Global

Please find the above out put sample

If i select Operational Americas , USA and CANADA should show

if i select Operational International, INDIA Only should show

if i select  Operational Global, USA,CANADA,INDIA Should show


List box should show only above output sample

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Create a new field Operational Group. Add this to the script:

Operational_Groups:

LOAD * INLINE [

Operational Group, Unit

Operational Americas, USA

Operational Americas, CANADA

Operational International, INDIA

Operational Global, USA

Operational Global, CANADA

Operational Global, INDIA

];


Reload the document.


Add a listbox with the new field Operational Group.


talk is cheap, supply exceeds demand
robert_mika
Master III
Master III

T2:

LOAD * INLINE

[

Unit

USA

CANADA

CHINA

JAPAN

INDIA

];

T1:

LOAD * INLINE

[

Oper

Operational Americas

Operational International

Operational Global

]

=if(GetFieldSelections(Oper)='Operational Americas','Only (USA , Canada )',

if(GetFieldSelections(Oper)='Operational International','Not (USA, Canada, China , Japan)',

if(GetFieldSelections(Oper)='Operational Global','Not (China, Japan)')))

Not applicable
Author

you could write an expression in listbox:

scroll to the end of the fields and select expression, in edit box put the following:

If( Unit = 'USA' or Unit = 'Canada', 'Operational Americas',

If( Unit = 'India', 'Operational International',

If( Unit <> 'Japan' and Unit <> 'China' , 'Operational Global')))

Anonymous
Not applicable
Author

Hi ,

Write the below code in script level then u can archive u r desired result

If(Unit='USA' or Unit='CANADA','Operational Americas',
If(Unit<>'USA'or Unit<>'CANADA' or Unit<>'CHINA'or Unit='JAPAN','Operational International',
If(Unit<>'CHINA'or Unit='JAPAN','Operational Global'))) as NEWUNIIT

Anonymous
Not applicable
Author

Hi Guys,

Thanks for your time,

I have 40 + units in my Database ,which option is gud.

Inline is working  fine

thanks

robert_mika
Master III
Master III

If you do not have mapping between those columns it will be hard to find ideal solution.

Gysbert's solution is most dynamic from all of those suggested.

Anonymous
Not applicable
Author

Hi GURUS,

Thanks for your Time,I implemented Gysbert methods,I am  able to achieve desired result

Thanks,