Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
thanhphongle
Creator II
Creator II

setting a constant value

Hello Community,

I want to create a constant value.

I managed implementing google map in a chart. Now I have a field with:

City
Berlin
Paris
London
Amsterdam
Roma

which I use as dimension. Google Map returns me every city from the field "City". Now i just want google map returns me Berlin constantly even if I haven't choses Berlin in a Listbox. How can I manage that?

I tried to edit the dimension in City=Berlin , but it doesnt really work. Could anyone help me out here?

10 Replies
Anonymous
Not applicable

did you try as calculated Dimension?

if (City='Berlin', City)

Anonymous
Not applicable

without selecting a City you need to put in in axpression with set analysis

max({<City={'Berlin'}>}City)

miguelbraga
Partner - Specialist III
Partner - Specialist III

Hi,

In the listbox "City", select "Berlin" and then go to the properties and check "Always One Selected Value" and make then lock the Listbox. Have a nice coding in QV

Regards,

MB

thanhphongle
Creator II
Creator II
Author

Thank you for responding. I ve just tried both of your solutions.

@Rudolf the if statement works fine but only if I zoom far away. Unfortunel it does not zoom me automatically to the city i want to see. I attached a qv file. could u have a look at it ?

@Miguel if i do it as u say it leaves me chosen permantly Berlin.

miguelbraga
Partner - Specialist III
Partner - Specialist III

Just unlock the listbox and you have set your listbox with always one variable chosen

Not applicable

But it doesn't work, I think.

If you choose other city than Berlin it deselect Berlin...

The "Always One Selected Value" option doesn't lock in Berlin.

Giba

Not applicable

If you try these solutions and didn't work, try to separate the table "City" and create a "FixCity" for example.

And into this new table put the cities you want.

Or a new field.

Then you'll have 2 list box:

the normal one

the fixed cities one

Giba

Anonymous
Not applicable

if you use the following expressions it works

Longitude: =sum({<City={'Leipzig'}>} round (256*pow(2,($(var_zoom)-1)))+( Longitude  *((256*pow(2,$(var_zoom)))/360)) )

Latitude: =sum({<City={'Leipzig'}>}((256*pow(2,($(var_zoom)-1)))+((0.5*log((1+(sin((Latitude)*pi()/180)))/(1-(sin((Latitude)*pi()/180)))))*((-256*pow(2,$(var_zoom)))/(2*pi())))))

third Expression remains: max({<City={'Leipzig'}>}City)

But you only see one dot (for Leipzig) in Overall map (all countries). When zooming it goes down to City Level Leipzig

Not applicable

Hello,

My solution is somewhat similar to what Gilberto had suggested.

You could add a variable vCity = BERLIN, then add it as a second dimension to your chart :

vCity.PNG

If no other city is selected, the map only shows Berlin. Otherwise, it'll show all the cities selected by the user.