Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Valued Contributor II

Help need in count with variable.

Hi All,

I am trying to get count of Test

if I select ID in my list box all the Test should be counted for selected ID's in Listbox and count should be store into a variable .

RCYC:

load * Inline [

ID

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

];

Test:

load * Inline [

Test,ID

1,1

2,1

3,1

4,1

5,2

6,2

7,2

8,3

9,3

10,4

];

For more information sample app is attached.

Thanks

BKC

1 Solution

Accepted Solutions
Highlighted
Luminary
Luminary

Re: Help need in count with variable.

Hi,

You can use GetFieldSelections() function but you need to specify the third parameter which is optional. You need something like this:

=GetFieldSelections(ID, ',',1000)

Where 1000 values is the limit.

I wouldn't use Concat() because if there's nothing selecting then Concat() would return all the values. To tackle this issue you need a conditional statement (IF) which might be inefficient.

Hope this helps!

Cheers,

DV

www.QlikShare.com

View solution in original post

7 Replies
Highlighted

Re: Help need in count with variable.

From what I understand, try defining you variable using Concat function instead of GetFieldSelections. May be like this:

=Concat(DISTINCT ID, ',')


Attaching your qvw for reference

Best,

Sunny

Highlighted
Luminary
Luminary

Re: Help need in count with variable.

Hi,

You can use GetFieldSelections() function but you need to specify the third parameter which is optional. You need something like this:

=GetFieldSelections(ID, ',',1000)

Where 1000 values is the limit.

I wouldn't use Concat() because if there's nothing selecting then Concat() would return all the values. To tackle this issue you need a conditional statement (IF) which might be inefficient.

Hope this helps!

Cheers,

DV

www.QlikShare.com

View solution in original post

Highlighted
Valued Contributor

Re: Help need in count with variable.

instead of GetFieldSelections u can use this

=if(GetSelectedCount(ID)>0, Concat(ID,','))

Highlighted
Valued Contributor II

Re: Help need in count with variable.

Thank you 

It will give me some Idea.

Highlighted

Re: Help need in count with variable.

hi

Are you looking for this?

Create a variable named something like "vTestCount"

And add expression like = If(GetselectedCount(ID), Count(Test), 0)

// If user select ID field, then vTestCount counts the Test value else 0 is store for that variable

Highlighted
Luminary
Luminary

Re: Help need in count with variable.

BKC - In case you're interested in understanding Meta Data functions, you can check the following video:

http://qlikshare.com/241/

Cheers,

DV

Highlighted
Honored Contributor III

Re: Help need in count with variable.

Can you use ?

Count({$} Test )