Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
Champion
Champion

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
Creator II
Creator II

HI,

Please try below

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

Anonymous
Not applicable
Author

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

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?

marcus_sommer

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
Specialist
Specialist

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
Specialist
Specialist

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.