Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

Select in field action and aggr expression

Hello!

I develop employees project distribution model.

Each employee (ID_Employee) works one or several projects (ID_project) each week (WeekName) and has project load (Load).

I need buttons selecting 3 groups of employees:

  • Total project load by selected week >100%
  • Total project load by selected  week =100%
  • Total project load by selected week <100%

The use case is: users select one week and press one of 3 buttons.

I use expression ='('&concat(DISTINCT if(aggr(sum(Load),[ID_Employee])>1,ID_Employee), '|')&')' and 'select in field' action.

All buttons work correctly, but user needs to click twice if any of 3 buttons was clicked before. On the first click selection clears and on the second click new selection applies.

Is it possible to apply new selection by one click? I tried to add actions "clear the field" and "clear all" but is doesn't work.

Help me please.

1 Solution

Accepted Solutions
Not applicable

Re: Select in field action and aggr expression

Yay! It works!

Check this expression

=

'('&concat({<ID_Employee=>}

aggr(

if(

sum({<ID_Employee=>} Load)

//change below for the 3 buttons <1 =1 and >1

<1, 

only({<ID_Employee=>} ID_Employee)

)

,ID_Employee)

,'|')&')'

Note that only 1 action is needed. You can skip the "clear field selections" action...

Let me know if it also works on your side.

6 Replies
Not applicable

Re: Select in field action and aggr expression

I think the reason is...

>that while button 1 is selected...  the options of button 2 and 3 are not in the "possible set".

So with setAnalysis the expressions should be changed so this is circumvented.

I'll try (as far as time allows me) to give an example to fix.

#edit

What you can do to analyse your problem is

- add 3 textboxes (one next to each button)

- add the select in expression in it...

- and when you've don that,play with the buttons

- then you'll understand my mentioned issue

- this can be fixed by changing the expression so they ignore the selections

Not applicable

Re: Select in field action and aggr expression

Thank you, Roberto!

I tried set analysis expression ='('&concat(DISTINCT if(aggr(sum({<ID_Employee=>}aggr(DISTINCT sum({<ID_Employee=>} Load),[ID_Employee])),ID_Employee)>1,ID_Employee), '|')&')'

But it doesn't fix a problem.

Could you please give an example?

Not applicable

Re: Select in field action and aggr expression

I must admit that I have difficulties in getting it right.

Your expression also has the problem that it only works when button 1 is pressed OR all selections are cleared.

I feel like some nested aggregations are needed here... At least the textboxes give a clear hint why it doesn't work

Any others (setanalysis guru's) with ideas?

Additionally, I'm not sure if it is a bug (buhh!)

Because in the actions, you first clear the fieldselection... When you would do that manually, your buttons would work in 1 click (instead of 2).

Perhaps someone can shed some light on this behavior...

Not applicable

Re: Select in field action and aggr expression

Yay! It works!

Check this expression

=

'('&concat({<ID_Employee=>}

aggr(

if(

sum({<ID_Employee=>} Load)

//change below for the 3 buttons <1 =1 and >1

<1, 

only({<ID_Employee=>} ID_Employee)

)

,ID_Employee)

,'|')&')'

Note that only 1 action is needed. You can skip the "clear field selections" action...

Let me know if it also works on your side.

Not applicable

Re: Select in field action and aggr expression

Thank you, Roberto!

Not applicable

Re: Select in field action and aggr expression

You're welcome!

Community Browser