cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
powerapps890
Post Prodigy
Post Prodigy

Filter checked boxes on toggle

I have a toggle called toggle2 outside of the gallery inside the gallery for items this is my filter Filter(
collCCBMasterData,
If(
IsBlank(ComboBox1.Selected.Result) || ComboBox1.Selected.Result = "All",
true,
'Functional Area' in ComboBox1.SelectedItems
) && If(
IsBlank(ComboBox1_1.Selected.Result) || ComboBox1_1.Selected.Result = "All",
true,
'Backlog Status' in ComboBox1_1.SelectedItems
) && If(
IsBlank(Filter.Text),
true,
Filter.Text in 'Requirement Source'
) && If(
IsBlank(Search_.Text),
true,
Search_.Text in Name
)
). I also have a checkbox inside the gallery. When the toggle is hit, I only want the checked boxes to be shown in the gallery. Is there a way I can do this?

2 ACCEPTED SOLUTIONS

Accepted Solutions

Hi @powerapps890 ,

 

Does the check box bind to the column of  collCCBMasterData?

We can sort the collCCBMasterData by the column which stores the check box value when the toggle is on, so first make sure the check box value is saved to the collCCBMasterData each time the box is checked/unchecked.

Set the OnCheck property of checkbox:

Patch(collCCBMasterData,ThisItem,{CheckBoxColumn:true})

Set the OnUnCheck property of checkbox:

Patch(collCCBMasterData,ThisItem,{CheckBoxColumn:false})

Then, modify the Items of Gallery as follows.

If(Toggle2.Value,
Sort(
Filter(
collCCBMasterData,
If(
IsBlank(ComboBox1.Selected.Result) || ComboBox1.Selected.Result = "All",
true,
'Functional Area' in ComboBox1.SelectedItems
) && If(
IsBlank(ComboBox1_1.Selected.Result) || ComboBox1_1.Selected.Result = "All",
true,
'Backlog Status' in ComboBox1_1.SelectedItems
) && If(
IsBlank(Filter.Text),
true,
Filter.Text in 'Requirement Source'
) && If(
IsBlank(Search_.Text),
true,
Search_.Text in Name
)
)
,CheckboxColumn,Descending),
Filter(
collCCBMasterData,
If(
IsBlank(ComboBox1.Selected.Result) || ComboBox1.Selected.Result = "All",
true,
'Functional Area' in ComboBox1.SelectedItems
) && If(
IsBlank(ComboBox1_1.Selected.Result) || ComboBox1_1.Selected.Result = "All",
true,
'Backlog Status' in ComboBox1_1.SelectedItems
) && If(
IsBlank(Filter.Text),
true,
Filter.Text in 'Requirement Source'
) && If(
IsBlank(Search_.Text),
true,
Search_.Text in Name
)
))

Hope this helps.

Sik

View solution in original post

Hi @powerapps890 ,

 

Do you mean you want to remove the toggle, and want the checked boxes appear at the top of gallery after the boxes are checked?

Could you please modify the Gallery.Items property as follows?

Sort(
Filter(
collCCBMasterData,
If(
IsBlank(ComboBox1.Selected.Result) || ComboBox1.Selected.Result = "All",
true,
'Functional Area' in ComboBox1.SelectedItems
) && If(
IsBlank(ComboBox1_1.Selected.Result) || ComboBox1_1.Selected.Result = "All",
true,
'Backlog Status' in ComboBox1_1.SelectedItems
) && If(
IsBlank(Filter.Text),
true,
Filter.Text in 'Requirement Source'
) && If(
IsBlank(Search_.Text),
true,
Search_.Text in Name
)
)
,CheckboxColumn,Descending)

Sik

View solution in original post

13 REPLIES 13
BrianS
Super User
Super User

I may not understand completely but you should be able to set a variable with the oncheck and uncheck properties and tie that to the visible property of the other cards on the form.

Alex_10
Super User
Super User

do you want to hide unchecked boxes when toggle is on? If yes:

checkbox.visible = If(!toggle2 .Value || (toggle2 .Value && Checkbox1.Value), true, false);

If you want the gallery to show only items that have checked boxes and your initial code is correct:

Filter(collCCBMasterData,
If(IsBlank(ComboBox1.Selected.Result) || ComboBox1.Selected.Result = "All",
true,
'Functional Area' in ComboBox1.SelectedItems
) &&
If(IsBlank(ComboBox1_1.Selected.Result) || ComboBox1_1.Selected.Result = "All",
true,
'Backlog Status' in ComboBox1_1.SelectedItems
) &&
If(IsBlank(Filter.Text),
true,
Filter.Text in 'Requirement Source'
) &&
If(IsBlank(Search_.Text),
true,
Search_.Text in Name
) &&
If(!toggle2.Value,
true,
datacolumnForCheckbox = true
)
)

 

The first statement says that it expected 2 arguments and only got one. @Alex_10 

v-siky-msft
Community Support
Community Support

Hi @powerapps890 ,

 

As @Alex_10  wants to ask, do you want to hide the unchecked box or the item where the unchecked box is located if the toggle is hit?  

Does the check box bind to a column of the data source collCCBMasterData?

 

Given by your follow up, it seems that you just want to hide all uncheck boxes when toggle turns on. If so, please try this to Visible property of checkbox.

If(!Toggle2.Value || Self.Value,true, false)

Snipaste_2020-08-10_15-11-15.png

Hope this helps.

Sik 

That does hide the unchecked, but I want it to filter so the checked boxes are at the top and the user does not have to scroll @v-siky-msft 

Hi @powerapps890 ,

 

Does the check box bind to the column of  collCCBMasterData?

We can sort the collCCBMasterData by the column which stores the check box value when the toggle is on, so first make sure the check box value is saved to the collCCBMasterData each time the box is checked/unchecked.

Set the OnCheck property of checkbox:

Patch(collCCBMasterData,ThisItem,{CheckBoxColumn:true})

Set the OnUnCheck property of checkbox:

Patch(collCCBMasterData,ThisItem,{CheckBoxColumn:false})

Then, modify the Items of Gallery as follows.

If(Toggle2.Value,
Sort(
Filter(
collCCBMasterData,
If(
IsBlank(ComboBox1.Selected.Result) || ComboBox1.Selected.Result = "All",
true,
'Functional Area' in ComboBox1.SelectedItems
) && If(
IsBlank(ComboBox1_1.Selected.Result) || ComboBox1_1.Selected.Result = "All",
true,
'Backlog Status' in ComboBox1_1.SelectedItems
) && If(
IsBlank(Filter.Text),
true,
Filter.Text in 'Requirement Source'
) && If(
IsBlank(Search_.Text),
true,
Search_.Text in Name
)
)
,CheckboxColumn,Descending),
Filter(
collCCBMasterData,
If(
IsBlank(ComboBox1.Selected.Result) || ComboBox1.Selected.Result = "All",
true,
'Functional Area' in ComboBox1.SelectedItems
) && If(
IsBlank(ComboBox1_1.Selected.Result) || ComboBox1_1.Selected.Result = "All",
true,
'Backlog Status' in ComboBox1_1.SelectedItems
) && If(
IsBlank(Filter.Text),
true,
Filter.Text in 'Requirement Source'
) && If(
IsBlank(Search_.Text),
true,
Search_.Text in Name
)
))

Hope this helps.

Sik

View solution in original post

Thank you, this works perfectly. @v-siky-msft 

I have noticed an error with this.. The users previous answers are always pulled in and when the toggle is clicked the previous answers are not being filtered. It only filters the new checkboxes they select @v-siky-msft 

@v-siky-msft  I still can't get this to work. Could I just remove the toggle and change the filter so the checked boxes are always at the top?

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (68,467)