Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

hammermill21
Contributor II

Text Box Condition If More than one choice - Qlik Sense

Hello,

I have a Text & Image box that shows the names of generators when a Site is picked but when there is more than one generator it goes blank. I can't seem to find any way to add a condition to have to pick one type.

Is there a way to do this?

8 Replies
devarasu07
Honored Contributor II

Re: Text Box Condition If More than one choice - Qlik Sense

Hi,

Have u tried with FirstSortedValue with distinct function

=FirstSortedValue(distinct Product,-Sales)  // Product is dimension and sales is the measure. please update your field

or

=FirstSortedValue(Product,-Sales,1)  // in addition u can use Concat function (but the image i haven't test)

P.S: in the above expression instead product u can add the image url

If it's not working can you share the mock data and expected out in excel format. thanks

Thanks,

Deva

Re: Text Box Condition If More than one choice - Qlik Sense

Hi Elizabeth, I think you need an extension to set the 'Always' one value selcted option', like:

- Re: Mandatory always one selected value in qliksense

- GitHub - alner/qsSimpleList

pradosh_thakur
Valued Contributor III

Re: Text Box Condition If More than one choice - Qlik Sense

did you try using concat(fieldname)

hammermill21
Contributor II

Re: Text Box Condition If More than one choice - Qlik Sense

Hello,

Yeah that doesn't seem to work either.

hammermill21
Contributor II

Re: Text Box Condition If More than one choice - Qlik Sense

Thanks for the info. But that's not going to work, but it's a great extension, thanks for sharing!

rittermd
Honored Contributor

Re: Text Box Condition If More than one choice - Qlik Sense

Can you share the expression that you are using?

hammermill21
Contributor II

Re: Text Box Condition If More than one choice - Qlik Sense

Hello Mark,

RIght now for my Text & Image function I have: ='GENERATOR MODEL'

So when you select a facility the generator that is located there will show in the text box. But when there is more than one generator nothing shows.

Re: Text Box Condition If More than one choice - Qlik Sense

Hi Elizabeth, if there are more than one value, qlik returns Null(), represented as a blank value or with a dash.

In Case a funtion returns more than one value you need to tell what to do with this values, like the Concat() funtion pradosh posted:

- Concat([GENERATOR MODEL], ', ') // returns the values separed by commas

- Concat(Distinct [GENERATOR MODEL], ', ') // returns the distinct values separed by commas


There are other options the transform "many values" in the needed "one value":

- MinString([GENERATOR MODEL]) // returns the first value sorted by text

- MaxString([GENERATOR MODEL]) // returns the last value sorted by text