Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
QFanatic
Creator
Creator

Pre-select On Field

hi

PFA

On the Period Field, have a field 'HasValue' = 1 is Yes, 0 is No.

If the user selects "Select Periods" in the Button, I would like to apply the filter "HasValue = 1" to the Period Field.

If they select the opposite, I would like to clear that filter. (I cannot apply a Bookmark - they have been disabled on our system)

 

How do I do it?

 

Thanks!

 

Labels (2)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

Vegar_1-1618986764051.png

I created an alternative to the variable based solution of @edwin , using select in field. Notice that sending an empty string as a search parameter clears your selection. 

I used HasValue>0 in my IF because the sample application did not contain 1 and 0, it contained    2 and 0, my example will work for both scenarios. 

Vegar_2-1618986990640.png

 

View solution in original post

4 Replies
edwin
Master II
Master II

need more info, this will depend.  assuming that HasValue can only either be 1, 0.  is the field set to always one selected?  if neither is selected, did you want to set it to 1?  is it possible for the field to be both selected?  if so, what do you do?

if the field is always one selected (in one list box):
in action add select field

field: HasValue
value: if(only(HasValue)=1,0,1)


this gets complicated if it is not set to always one selected.  you need to add if conditions for when no selection is made or when both possible values are selected like:


if(getselectedcount(HasValue)<>1, 1,
if(only(HasValue)=1,0,1
)
)

tweak that depending on your actual scenario

QFanatic
Creator
Creator
Author

Hi Edwin,

Thank you so much for your reply.

So HasValue can have only one at a time selected...either 1, or it is cleared (HasValue=). If they have nothing selected, I want it cleared. Hope that makes sense.

Appreciate your assistance

Vegar
MVP
MVP

Vegar_1-1618986764051.png

I created an alternative to the variable based solution of @edwin , using select in field. Notice that sending an empty string as a search parameter clears your selection. 

I used HasValue>0 in my IF because the sample application did not contain 1 and 0, it contained    2 and 0, my example will work for both scenarios. 

Vegar_2-1618986990640.png

 

QFanatic
Creator
Creator
Author

Awesome Vegar! Thank you so much!