Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

sofiavaz
Contributor

Issue with getfieldselection(), getselectedcount(),..

Hi all,

I'm trying to add a calculation conditional to a stacked bar chart. The ideia is that values only be displayed if and Warehouse (InventoryReelsWhseCd) is selected. Thus, I think the calculation condition should be something like GetSelectedCount(InventoryReelsWhseCd)=1.

However, none of the function (getfieldselection() or getselectedcount()) is working with this field (InventoryReelsWhseCd) and I have no clue on how to understand whats going on...

When using this functions with other fields they work perfectly...

Any help will be appreciated!

Thanks in advance.

Sofia Vaz

7 Replies
YoussefBelloum
Esteemed Contributor

Re: Issue with getfieldselection(), getselectedcount(),..

Hi,

would you be able to share sample app where you can't find out how to configure a conditionnal display/calculation on the object ?

rajeshqvd
Contributor

Re: Issue with getfieldselection(), getselectedcount(),..

HI,

Please try below

=IF(GetSelectedCount(InventoryReelsWhseCd)>0,InventoryReelsWhseCd,"here give default dimension")

sofiavaz
Contributor

Re: Issue with getfieldselection(), getselectedcount(),..

Hi Youssef,

thanks for you response. I'm afraid i'm not allowed to share a sample.

I know how and where to configure the calculation condition, the problem is that getfieldselection() is not working with the field I need..

OmarBenSalem
Esteemed Contributor

Re: Issue with getfieldselection(), getselectedcount(),..

The first thing to do is :

Create 3 KPI objects:

1) getfieldcount(YourField)

2) len(trim(GetfieldSelections(YourFields)))

3) count(distinct YourField)

And see what happens when u don't select anything and when u select a one or different values of YourField.

Based on what happens and what would be easier for u to define in ur expressions; choose one of the 3 above.

Hope that would help?

Re: Issue with getfieldselection(), getselectedcount(),..

Make sure that you grab the right field with the right spelling (considering that Qlik is case-sensitiv and that there might be also a qualifying).

- Marcus

wdchristensen
Contributor III

Re: Issue with getfieldselection(), getselectedcount(),..

GetSelectedCount(InventoryReelsWhseCd) > 0

If you put InventoryReelsWhseCd in a variable you have to use the name of the variable, the field name will not work. For example, if your filter is $(vInventoryReelsWhseCd) then you must use GetSelectedCount("=$(vInventoryReelsWhseCd)") > 0


Qlik Sense 3.2 doesn't recognize $(vInventoryReelsWhseCd) and InventoryReelsWhseCd equivalent in the GetSelectedCount function.

wdchristensen
Contributor III

Re: Issue with getfieldselection(), getselectedcount(),..

Might try GetPossibleCount(InventoryReelsWhseCd) to help ensure it returns a value greater than zero.

I would put the result in a KPI to ensure the function is working before adding additional logic.

Community Browser