Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

(GetFieldSelections([Text Field]) not working

Hi Masters,

I'm using SHOW CONDITIONAL in a Table Box that I only want it to appear when the user has selected a value from a List Box.

It works well with a numeric field, but it does not work with a text field.  Any idea how to resolve it?

This works:

=if(GetFieldSelections([Project Number]),1,0)

This DOES NOT work:

=if(GetFieldSelections([Project Name]),1,0)

Thanks in advance for your help!

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Getfieldselections returns the actual selected values. If you use the return value of getfieldselections as a boolean, i.e. True or False, like you do in your if statement then any number other than 0 is evaluated as True. Text values are evaluated as False.

What you can do instead is use the getselectedcount function: if(GetSelectedCount([Project Name]),1,0).

Actually since the expression for Show Conditional should return True or False you can leave out the if statement and use just GetSelectedCount([Project Name]). If there are selections in Project Name then getselectedcount will be larger than 0, i.e. True. If there are no selections then 0 is returned, i.e. False.


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

Getfieldselections returns the actual selected values. If you use the return value of getfieldselections as a boolean, i.e. True or False, like you do in your if statement then any number other than 0 is evaluated as True. Text values are evaluated as False.

What you can do instead is use the getselectedcount function: if(GetSelectedCount([Project Name]),1,0).

Actually since the expression for Show Conditional should return True or False you can leave out the if statement and use just GetSelectedCount([Project Name]). If there are selections in Project Name then getselectedcount will be larger than 0, i.e. True. If there are no selections then 0 is returned, i.e. False.


talk is cheap, supply exceeds demand
Not applicable
Author

It worked perfectly!    Thanks a tonsssss