Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
mattphillip
Creator II
Creator II

Counter for number of current selections

Hoping someone can help. I'm using the below code to count the number of selections currently made which I'm mounting within a small text box as a small indicator to remind users when selections have been made (without the need to fully open the current selections box itself. My issue is scripting the conditional coding so it hides again when there are no selections made. Currently the below script produces the result of '-' when there are no selections. However, when I try my statement, see below, it doesn't work.

Does anyone have any idea why this might be the case?

Current Selections Counter Object

SubStringCount( GetCurrentSelections(':', ',', '@', 100), ':')+1

Conditional statement

SubStringCount( GetCurrentSelections(':', ',', '@', 100), ':')+1<>'-'

Any help would be most appreciated.

Matt

Labels (3)
1 Solution

Accepted Solutions
thomaslg_wq
Creator III
Creator III

If there are no selections the results of the function "getcurren.." = null

1 - you cannot add a number to null : the output is null
2 -a null output is often visualized as "-" in Qlik, but it does not equal the string "-"

Instead, use this in condition:
if(isnull(SubStringCount( GetCurrentSelections(':', ',', '@', 100), ':')),0,1)

View solution in original post

2 Replies
thomaslg_wq
Creator III
Creator III

If there are no selections the results of the function "getcurren.." = null

1 - you cannot add a number to null : the output is null
2 -a null output is often visualized as "-" in Qlik, but it does not equal the string "-"

Instead, use this in condition:
if(isnull(SubStringCount( GetCurrentSelections(':', ',', '@', 100), ':')),0,1)
mattphillip
Creator II
Creator II
Author

Brilliant thanks!