Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

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

Re: Issue with case of a variable with a parameter

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

Community Browser