Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
BI & Data Trends 2021. Discover the top 10 trends emerging in today. Join us on Dec. 8th REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor II
Contributor II

GetSelectedCount() in Concat() Function

Hi,

I need this:

GetSelectedCount(Field_1 ) & ',' & GetSelectedCount(Field_2) & ',' & ... & GetSelectedCount(Field_N) .

The result, if I apply no filter, is:

0,0,...,0

In my app I have hundreds of fields and I can't write a GetSelectedCount() function for each field then I want to use Concat() function. But if I use Concat() function in the follow way the result is wrong:

Concat(GetSelectedCount($Field),',')

The result is 0.

What is the correct syntax?

Thank you

1 Solution

Accepted Solutions
Highlighted
MVP & Luminary
MVP & Luminary

Ok. Then you could use the following approach:

= -rangesum($(='getselectedcount([' & concat({< $Table = {'Stores'}>} $Field, '])>0, getselectedcount([') & '])>0'))<=10

which concats the fields from a certain table (you need to add there your tables and maybe a few further exclusions) in a getselectedcount-function-wrapping with an additionally check to >0 which returns TRUE or FALSE and which is summed within a range-function by using a $-sign expansion. Depending on your real requirements it might be useful to use several of those $-sign parts within a range-function and/or creating similar conditions between them.

To comprehend how it worked just put the parts in a textbox and see what happens.

- Marcus

View solution in original post

9 Replies
Highlighted
MVP & Luminary
MVP & Luminary

What is the aim for querying the selection-count for hundreds of fields?

- Marcus

Highlighted
Contributor II
Contributor II

I have to write this condition

GetSelectedCount(Field_1) = 0 or GetSelectedCount(Field_2) = 0 or ... or GetSelectedCount(Field_N) = 0

This condition concerns hundreds of fields but not all the fields.

 

Gabriele

Highlighted
MVP & Luminary
MVP & Luminary

The question was: why do you want to do it? Because there might be other and better ways to solve the task behind your question. Currently I have difficulties to see a reason for it - unless you are loading big crosstables within your application and if it's the case I suggest to rethink the datamodel and not handling hundreds of fields in single calculations.

- Marcus

Highlighted
Contributor II
Contributor II

I have to write a visibility condition for a chart.

If I filter 10 specific fields the chart is shown.

If I filter other fields (there are too many other fields) the chart is NOT shown (the chart is NOT shown also if I filter the 10 specific fields and another field that is not included in those 10 specific fields).

 

Gabriele

Highlighted
MVP & Luminary
MVP & Luminary

Ok. Then you could use the following approach:

= -rangesum($(='getselectedcount([' & concat({< $Table = {'Stores'}>} $Field, '])>0, getselectedcount([') & '])>0'))<=10

which concats the fields from a certain table (you need to add there your tables and maybe a few further exclusions) in a getselectedcount-function-wrapping with an additionally check to >0 which returns TRUE or FALSE and which is summed within a range-function by using a $-sign expansion. Depending on your real requirements it might be useful to use several of those $-sign parts within a range-function and/or creating similar conditions between them.

To comprehend how it worked just put the parts in a textbox and see what happens.

- Marcus

View solution in original post

Highlighted
Contributor II
Contributor II

Thank You,

tomorrow in the morning I will try your approach.

I will say you if is right for my problem.

Thank you very much

 

Gabriele

Highlighted
Contributor II
Contributor II

Thanks Marcus, I'm trying your approach but for now it doesn't work.

Gabriele

Highlighted
MVP & Luminary
MVP & Luminary

For me it worked - I tried it. Maybe there is just a some small syntax/logic issue in your attempt but if you split the parts of the logic into single statements - maybe within a pivot without any further dimensions and leaving the expression-labels blank to see there the evaluation-results from Qlik - it shouldn't be too difficult to find the issue.

- Marcus

Highlighted
Contributor II
Contributor II

It works 🙂

Thanks a lot