Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

List Box conditional Show

Hi all,

I need to create a List Box with few cities and I need to filter the cities that are not in Europe.

I have Longitude and Latitude for every city.

I have tried to use "If" like this:

=If(P_Longitude<=60 and P_Longitude>=11 and P_Latitude<=71 and P_Latitude>=36,1,0)

Obviously it did not work. can someone please help?

1 Solution

Accepted Solutions
Highlighted

Re: List Box conditional Show

you can try this expression in listbox.

=If(P_Longitude<=60 and P_Longitude>=11 and P_Latitude<=71 and P_Latitude>=36,'Europe','Others')


But instead of doing like this, you can do it in the script itself. Like


LOAD *,If(P_Longitude<=60 and P_Longitude>=11 and P_Latitude<=71 and P_Latitude>=36,'Europe','Others') as Region;
LOAD * INLINE [
P_Latitude, P_Longitude, Plant_ID, PlantName
-6.181015, 106.828335, 4, Jakarta
35.680071, 139.768522, 2, Tokyo
40.713054, -74.007228, 3, New York
51.507276, -0.12766, 6, London
52.374733, 4.898117, 1, Amsterdam
55.751615, 37.618701, 5, Moscow
]
;

Then simply create the 'Region' Listbox.

View solution in original post

8 Replies
Highlighted

Re: List Box conditional Show

Is this something you are thinking of doing on the front end of the script or back end?

Highlighted

Re: List Box conditional Show

May be like this on the front end:

Aggr(Only({1<Country ={'*'}-{'Europe'}>} City), City)

Highlighted
Not applicable

Re: List Box conditional Show

First, thank you for you answer.

I did not understand it quite well, I am very new with this.

Let me write it again:

I have this table in Excel-

P_LatitudeP_LongitudePlant_IDPlantName
-6.181015106.8283354Jakarta
35.680071139.7685222Tokyo
40.713054-74.0072283New York
51.507276-0.127666London
52.3747334.8981171Amsterdam
55.75161537.6187015Moscow

And I need to create a chart only the cities in Europe.

Highlighted

Re: List Box conditional Show

You only have Longitude and Latitude? Don't have a field which explicitly states the name of the Country? Are you trying the if statement in the script to create flags?

Highlighted

Re: List Box conditional Show

you can try this expression in listbox.

=If(P_Longitude<=60 and P_Longitude>=11 and P_Latitude<=71 and P_Latitude>=36,'Europe','Others')


But instead of doing like this, you can do it in the script itself. Like


LOAD *,If(P_Longitude<=60 and P_Longitude>=11 and P_Latitude<=71 and P_Latitude>=36,'Europe','Others') as Region;
LOAD * INLINE [
P_Latitude, P_Longitude, Plant_ID, PlantName
-6.181015, 106.828335, 4, Jakarta
35.680071, 139.768522, 2, Tokyo
40.713054, -74.007228, 3, New York
51.507276, -0.12766, 6, London
52.374733, 4.898117, 1, Amsterdam
55.751615, 37.618701, 5, Moscow
]
;

Then simply create the 'Region' Listbox.

View solution in original post

Highlighted
Not applicable

Re: List Box conditional Show

I do not know what flag is.

but I am trying to show in a List Box only the rows that mach the If condition.

Highlighted

Re: List Box conditional Show

Does this look like what you want?

Capture.PNG

I created a flag in the script:

Table:

LOAD *,

  If(P_Longitude<=60 and P_Longitude>=11 and P_Latitude<=71 and P_Latitude>=36,1,0) as Flag;

LOAD * INLINE [

    P_Latitude, P_Longitude, Plant_ID, PlantName

    -6.181015, 106.828335, 4, Jakarta

    35.680071, 139.768522, 2, Tokyo

    40.713054, -74.007228, 3, New York

    51.507276, -0.12766, 6, London

    52.374733, 4.898117, 1, Amsterdam

    55.751615, 37.618701, 5, Moscow

];

And then used the following expressions for the two list boxes:

1) =Aggr(Only({1<Flag = {1}>} PlantName), PlantName)

2) =Aggr(Only({1<Flag = {0}>} PlantName), PlantName)

Highlighted
Not applicable

Re: List Box conditional Show

Thank you all for you help!!!!!!!!!