Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Using IF condition in Text box

Hello friends,

I need your help in what seem to be easy and straightforward yet i am not able to do it. I am trying to create a text box which how name of the market when i select an agent.

for this i am doing

='Market: ' & Market

and the outcome is something like Market: Alabama. Now  the problem is if the agent has multiple markets the filed goes Blank

I tired using

=if(Market>1, 'Multiple Markets', Market)

But nothing works. Please help me out with this.

I really appreciate all your help and support.

Thank you,

Syed.

1 Solution

Accepted Solutions
MVP
MVP

Re: Using IF condition in Text box

Try aggregation functions:

='Market: ' & Concat(DISTINCT Market,', ')

or

=If(Count(DISTINCT Market)>1,'Multiple', Only(Market) )

6 Replies
MVP
MVP

Re: Using IF condition in Text box

Try aggregation functions:

='Market: ' & Concat(DISTINCT Market,', ')

or

=If(Count(DISTINCT Market)>1,'Multiple', Only(Market) )

MVP
MVP

Re: Using IF condition in Text box

for this i am doing

='Market: ' & Market

and the outcome is something like Market: Alabama. Now  the problem is if the agent has multiple markets the filed goes Blank

your expression is

='Market' & only(Market)

The Only Function

this is the reason you get a blank

You should use in that case an aggregation function, it could be

concat (or concat distinct) to get all the markets

maxstring, minstring 

Not applicable

Re: Using IF condition in Text box

Thank you for the Explanation ..it really helped

Not applicable

Re: Using IF condition in Text box

Thank you  ...Concat did what i wanted with it. But while i was working this out i ran into another issue. I have a list box that shows all the agents in all the region. I want this list box to be filtered to all the agents from a specific region the selected agent is from.

For example, if my selected agent belongs to region 1, then i want to show all the other agents that belong to region 1 in the list box. I have no idea how to go about with this. Please help me.

Thank you,

Syed.

MVP
MVP

Re: Using IF condition in Text box

syed quadri wrote:

Thank you  ...Concat did what i wanted with it. But while i was working this out i ran into another issue. I have a list box that shows all the agents in all the region. I want this list box to be filtered to all the agents from a specific region the selected agent is from.

For example, if my selected agent belongs to region 1, then i want to show all the other agents that belong to region 1 in the list box. I have no idea how to go about with this. Please help me.

Thank you,

Syed.

Try a field <expression> in your list box like

=Aggr( Only({<Agent=, Region = p()>} Agent), Agent)

sravanthialuval
Contributor

Re: Using IF condition in Text box

Try this:

Using getfieldselections() you will get all market names.

='Market' & '-' &GetFieldSelections(Market)

img.png

Community Browser