Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
nihhalmca
Specialist II
Specialist II

Dynamic Name Changing in Chart Caption

Hi All

I want to show dynamic header name changing for example ='country =' & country, if i select single country it will show country name on caption but if i select more than one selection on country it did not show on caption and what is difference between ='country =' & country and ='country =' & only(country) please let me know solution for this requirement

Thanks in Advance

Nihhal

10 Replies
Not applicable

Hi

try

='Country = ' & GetFieldSelections(country)

nihhalmca
Specialist II
Specialist II
Author

Thank you Alexis, what is difference between ='country =' & country and ='country =' & only(country), do you have any idea

Not applicable

Hi Nihhal L,

Would the following help you?

=concat(Country, ' , ')

What it does is, it lists possible Countries and avoids duplication of it while separating them with a comma.

Let us know how it goes.

Best wishes,

nihhalmca
Specialist II
Specialist II
Author

Sorry Kadir i could not understand please let me know what exactly doing only () here

tresesco
MVP
MVP

In this case, no difference is there. Only() function returns a NULL if not single value is selected(in other words, it can return a value if the scope is limited to a single value). If you use the field name alone, then qv treats it as Only(fiel name) internally.

Not applicable

only() function means it will return a single value at a time. of course it will still depend on function combination

example:

if you have country with data as A,B, C, D

aggr(only({<country = {'A','B'}>}country),country) //this will return country A and B

while only(country) // this will return a single country (whichever you selected) at a time.

so on your question with

=country vs =only(country)

=country //will list all possible country when used as dimension

while =only(country) //will list a single country when used as dimension.

preminqlik
Specialist II
Specialist II

Hi there

try this

='Country = ' & if(LEN(Country)>0,MaxString(Country),'All Countries')

BY DEFAULT IT SHOWS ALL COUNTRIES, WHEN U SELECT COUNTRY IT SHOW PARTICULAR COUNTRY

REGARDS

PREMHAS

Not applicable

Hi NIhhal,

When you use Only() function, it will return only one selection from the particular field.

Your requirement is, to display no.of selected items in the field 'Country'.

Option:1

=GetCurrentSelections(Country)

Will display Name of the Field and the values from that field. (One or More)

But it will display NULL, when no selection were made.

Option:2

='Country :'&GetFieldSelections(Country)

This will return the selected items from the field (One or More).

As the expression contains 'Country : '& will display all the time (when no selection is made, will return name Country).

I welcome all your comments and feedback.

Regards,

Pavan Kumar.Capture.JPG.jpg

Not applicable

Hi NIhhal,

what exactly doing only () here?


Only() function will only return selected item from a particular field.

If no selection were made, then nothing to display.


When you are trying to use Only(Country).

It will display only one selected item from country field, if you select more that one item or no selection were made, there is nothing to display.


Hope you got the solution.

I welcome all your comments and feedback.


Regards,

Pavan Kumar.