cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
markus_poeschl
Helper I
Helper I

Filter/Update Gallery by Button

Hi all,

I´m almost done with my first app, but am struggling with one last thing:

 

i have a gallery in the main-screen using this:

 

SortByColumns(Filter(Antrag, StartsWith(Familienname, SucheFeld1.Text)), "Title", If(SortDescending1, Descending, Ascending))

 

near to the gallery i have an icon for Ascend/Descend - Sorting, thats works fine. Also searching for the Name via an input field.

 

What i now need (the last feature) is using a radio-button for filtering this gallery using a boolean-Field in the

data-source named "NeuErstellt" .. so when i toggle the button only those with "true" are shown, untoggled ALL items should be shown.

I tried fiddling around with "updatecontext()" but did not come to a conclusion.

 

maybe somebody can help me with a short "push" ?

 

Kind regards,

Markus

1 ACCEPTED SOLUTION

Accepted Solutions

i figured it out now. Here´s my solution:

 

------------

If (Checker1 = 1, (SortByColumns(

Filter(

Filter(Antrag, StartsWith(Familienname, SucheFeld1.Text)),

If(Checker1 = 1, NeuErstellt<>true, false)

),

"Title",

If(SortDescending1, Descending, Ascending))),

SortByColumns(Filter(Antrag, StartsWith(Familienname, SucheFeld1.Text)), "Title", If(SortDescending1, Descending, Ascending)))

 

------------

 

So thank you all for the "pushes" in the right direction !

View solution in original post

4 REPLIES 4
panand99
Impactful Individual
Impactful Individual

You can use like this :

 

if(radio1.selected.value="YourValue",

SortByColumns(Filter(Antrag, NeuErstellt=true && StartsWith(Familienname, SucheFeld1.Text)), "Title", If(SortDescending1, Descending, Ascending)),

SortByColumns(Filter(Antrag, StartsWith(Familienname, SucheFeld1.Text)), "Title", If(SortDescending1, Descending, Ascending)))

@markus_poeschlif your source is SharePoint, be aware that there is currently a bug on boolean fields.

I have found the workaround for the time being to set my condition to the opposite. 

 

So an potential formula for you is something like this:

SortByColumns(

    Filter(

       Filter(AntragStartsWith(Familienname, SucheFeld1.Text)),

       If(Radio1.Selected.Value = "Your Value", NeuErstellt<>false, true)

       ),

    "Title",

     If(SortDescending1, Descending, Ascending))

       

Note, this is a filter of a filter - perfectly legitimate, but you could also possibly combine the statement.  I put it out in two to show a little clarity of what is going on based on your condition.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Dear panand,

 

thank you , i understand you concept, but when this formula is implemented i adopted it to:

 

>> Checkbox1 is  Oncheck = "UpdateContext({Check1:true})" and "false" on OnUncheck ...<<

 

 

If(Check1=true,

SortByColumns(Filter(Antrag, NeuErstellt=true && StartsWith(Familienname, SucheFeld1.Text)), "Title", If(SortDescending1, Descending, Ascending)),

SortByColumns(Filter(Antrag, StartsWith(Familienname, SucheFeld1.Text)), "Title", If(SortDescending1, Descending, Ascending)))

 

But now neither the filter itself, nor the textsearch or the sorting work anymore .. 

 

Kind regards,

i figured it out now. Here´s my solution:

 

------------

If (Checker1 = 1, (SortByColumns(

Filter(

Filter(Antrag, StartsWith(Familienname, SucheFeld1.Text)),

If(Checker1 = 1, NeuErstellt<>true, false)

),

"Title",

If(SortDescending1, Descending, Ascending))),

SortByColumns(Filter(Antrag, StartsWith(Familienname, SucheFeld1.Text)), "Title", If(SortDescending1, Descending, Ascending)))

 

------------

 

So thank you all for the "pushes" in the right direction !

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,487)