Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
gabriele_qlik
Contributor III
Contributor III

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

Labels (4)
1 Solution

Accepted Solutions
marcus_sommer

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
marcus_sommer

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

- Marcus

gabriele_qlik
Contributor III
Contributor III
Author

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

marcus_sommer

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

gabriele_qlik
Contributor III
Contributor III
Author

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

marcus_sommer

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

gabriele_qlik
Contributor III
Contributor III
Author

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

gabriele_qlik
Contributor III
Contributor III
Author

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

Gabriele

marcus_sommer

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

gabriele_qlik
Contributor III
Contributor III
Author

It works 🙂

Thanks a lot