cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted

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

Highlighted

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
Highlighted
Responsive Resident
Responsive Resident

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.

Highlighted
Responsive Resident
Responsive Resident

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

 

Highlighted

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

Highlighted
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 

Highlighted

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 

Highlighted

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

Highlighted

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

Highlighted

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 

Highlighted

@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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (6,069)