Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
IAMDV
Luminary Alumni
Luminary Alumni

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
sunny_talwar

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

IAMDV
Luminary Alumni
Luminary Alumni

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

ankit777
Specialist
Specialist

instead of GetFieldSelections u can use this

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

Anonymous
Not applicable
Author

Thank you 

It will give me some Idea.

MayilVahanan

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

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
IAMDV
Luminary Alumni
Luminary Alumni

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

http://qlikshare.com/241/

Cheers,

DV

sasiparupudi1
Master III
Master III

Can you use ?

Count({$} Test )