Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

What does 'Get SelectedCount' actually do ?


Hi,

I've come across a function (??) called GetSelectCount in a script. What does it actually do ? The actual code is as follows:

=If(GetSelectCount($(SalesYear))=0,Year(Today()),MaxString($(SalesYear)))

What does it count ?

Thanks for your help

MV

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Here SalesYear is a variable and gets expanded with dollar sign. It is expected to return a field name. Hence the getselectedcount($(SalesYear)) would return number of field values that are selected in that field.

View solution in original post

14 Replies
PradeepReddy
Specialist II
Specialist II

Hi,

Getselectedcount() - Function returns the number values we are selecting in that Field.

In Your case,

If you are not selecting any year, it returns the Current Year,

If you are selecting one or more than one year, it returns maximum of the slected year.

Thanks,

Pradeep

Not applicable
Author

GetSelectedCount(fieldname [, includeexcluded=false])

returns the number of selected values in the field named fieldname. If includeexcluded is stated as true, the count will include selected values which are excluded by selections in another field.

Examples:

getselectedcount( Customers )
getselectedcount( Customers, true )

tresesco
MVP
MVP

Here SalesYear is a variable and gets expanded with dollar sign. It is expected to return a field name. Hence the getselectedcount($(SalesYear)) would return number of field values that are selected in that field.

Not applicable
Author

OK...so are you saying if I select years 2010 and 2012 then the number of field values returned will be 2 ?

israrkhan
Specialist II
Specialist II

No,

if you will select 2010 and 2011, it will return you 2011, and if you will select 2011, 2012, 2013 it will return you 2013,

simply it will return you the maximum selected year, if nothing is selected than it will return you the maximum year from that listbox.

tresesco
MVP
MVP

Goto variable overview window and see the definition of the variable. Then you would understand for which field the result is expected.

Not applicable
Author

Ah thank you...it's the value of the field, not the 'number of field values' as tresesco suggested.

I understand it now.

tresesco
MVP
MVP

Dear,

what I said was about getselectedcount() alone (that is exactly what you asked for in your question title) and not about the entire expression. However, it's a misunderstanding, good that you got your answer.

israrkhan
Specialist II
Specialist II

if you have got the answer ,than close the thread..