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: 
jaygarcia
Contributor III
Contributor III

Issue with case of a variable with a parameter

Hi guys,

I need some help with this case of variables with parameters on QS.

I need to create a dynamic Label expression for the dynamic dimension _SPEC1 or _SPEC2. The labels could be either _LONG_SPEC_NAME1 or _LONG_SPEC_NAME2 fields which will depend on the condition if CUSTOM_GROUP field count is 0 then _LONG_SPEC_NAME1 else _LONG_SPEC_NAME2. But I also need to evaluate if GetPossibleCount(_SPEC1)<>1 then this message should appear instead in the Label: 'Select One Dimension Only'.

I've done this:

Label Expression:

=if(Count({1} CUSTOM_GROUP)=0,'$(vSpecTitle(1))','$(vSpecTitle(2))')

Where vSpecTitle=

IF(GetPossibleCount(_SPEC$1)<>1,'Select One Dimension Only', _LONG_SPEC_NAME$1)

For some reason, it's showing me 'Select One Dimension Only' even though I can see in the Text box that Count({1} CUSTOM_GROUP) is 0 and GetPossibleCount(_SPEC1) is 1 which should show  _LONG_SPEC_NAME1. So something it's not right in my expressions.

Any thoughts?

1 Reply
jaygarcia
Contributor III
Contributor III
Author

In case it's helpful for someone:

Found the solution finally! Thanks to "Q-Tip #6 – Those Tricky $-Sign Expansions http://www.naturalsynergies.com/q-tip-6-those-tricky-sign-expansions/" and a lot of try and error


Label Expression:

=if(Count({1} CUSTOM_GROUP)=0,$(=$(vSpecTitle(1))),$(=$(vSpecTitle(2))))

Variable:

vSpecTitle = 'IF(GetPossibleCount(_SPEC'&$1&')=1,_LONG_SPEC_NAME'&$1&',vSelectOneDimMsg)' 

where vSelectOneDimMsg = 'Select One Dimension Only'

Jay