Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

b_neumayer
New Contributor III

QV: Reflect single value in textbox

Dear all,

I am trying to create a textbox that reflects a single string value depending on the current selections and a formula integrated in the textbox itself.


Textbox currently contains the following query: =if([Event Year]=2017), 'Resort')

My Database is organized this way:

Event YearEventResortGame
2017

World Cup

A-CityGame 1
2017World CupA-CityGame 2
2016World CupB-CityGame 1
2016World CupC-CityGame 2
2017European CupD-CityGame 1
2016European CupE-CityGame 1


Now, as soon as the user filters to event "World Cup", the textbox should be able, with the help of the if-formula, to reflect the respective single value, as for 2017 there is only one distinct value in this column?

However in order that the formula correctly shows "A-City", I have to filter to Event year 2017 with the help of a listbox.

Does anybody see the mistake I am making, or the information I am missing?

Thanks a lot

Benedikt

1 Solution

Accepted Solutions
vishsaggi
Esteemed Contributor III

Re: QV: Reflect single value in textbox

Try this in your text box:

= Concat(DISTINCT IF([Event Year] = '2017', Resort),  '|')

3 Replies
vishsaggi
Esteemed Contributor III

Re: QV: Reflect single value in textbox

Try this in your text box:

= Concat(DISTINCT IF([Event Year] = '2017', Resort),  '|')

craigsutton
Contributor

Re: QV: Reflect single value in textbox

Not sure exactly how you wanted to see it, but here is a way to only show a value if a single event is selected:

=If(GetSelectedCount(Event)=1,Concat({<[Event Year]={2017}>} DISTINCT Resort)) 

b_neumayer
New Contributor III

Re: QV: Reflect single value in textbox

Thanks Craig and Vishwarath, both your options work fine and give the correct results.