cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Responsive Resident
Responsive Resident

How create a buttons which has items to show only Distinct items in gallery (e.g Approve, reject and all buttons)

Display.pngHI All ,

Im trying to figure out how to use the button ONselect property to show the items based on Status filed in my share point list which also shows in gallery items. 

I Tried a lot of aways such as using updatecontext , using filter , or using switch and if statements but all shows and error and value are not what i wanted? 

 

Can anyone have any idea behind this that how i can filter the data in my gallery based on selected buttons?

For e.g if user select the button ALL, the items in gallery should show ALL the records, 
If the user selects reject he should see rejected records, and if selects approved he should approved records. 

 

I know how the flow works behind but I don't know how the gallery will be updated in power apps when the user clicks on anyone 3 buttons. 

 

I'm really in need of help. anyone please suggest the steps I can follow or the solution to this. 

 

 

Please note that I'm sorry if this question sounds silly to all professionals and other people here with talent, but I'm new to this and trying to learn more from you all and this page.

 

THanks 

Tapesh 

@eka @ek8 @Warren65 @WarrenBelz  @eka24 @antonicarluccio @Rima @rimatos @yuxi666 @mdevaney 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: How create a buttons which has items to show only Distinct items in gallery (e.g Approve, reject and all buttons)

Hi @Tapesh ,
Replace everything in blue with your control and field names.
You have three buttons - I will call them AllBtn, ApproveBtn and PendingBtn
You have a list I will call ItemList. In this list your have a filed called Status, which can be Approved or Pending
So the OnSelected of the AllBtn

UpdateContext({vStatus:"All"})

The ApprovedBtn

UpdateContext({vStatus:"Approved"})

The PendingBtn

UpdateContext({vStatus:"Pending"})

Now the Items property of your gallery

If(
   vStatus <> "All",
   Filter(
      ItemList,
      Status = vStatus
   ),
   ItemList
)

This will give you either all records or a set based on the button selected.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

6 REPLIES 6
Highlighted
Super User III
Super User III

Re: How create a buttons which has items to show only Distinct items in gallery (e.g Approve, reject and all buttons)

Hi @Tapesh ,
Replace everything in blue with your control and field names.
You have three buttons - I will call them AllBtn, ApproveBtn and PendingBtn
You have a list I will call ItemList. In this list your have a filed called Status, which can be Approved or Pending
So the OnSelected of the AllBtn

UpdateContext({vStatus:"All"})

The ApprovedBtn

UpdateContext({vStatus:"Approved"})

The PendingBtn

UpdateContext({vStatus:"Pending"})

Now the Items property of your gallery

If(
   vStatus <> "All",
   Filter(
      ItemList,
      Status = vStatus
   ),
   ItemList
)

This will give you either all records or a set based on the button selected.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Highlighted
Responsive Resident
Responsive Resident

Re: How create a buttons which has items to show only Distinct items in gallery (e.g Approve, reject and all buttons)

Hi @WarrenBelz 

 

Thanks for this great idea i think i was nearly there but im to thankful to you that you replied on very fast note. Sure ill try and see if this work, and update the solution.

 

Thanks again  sir

Highlighted
Responsive Resident
Responsive Resident

Re: How create a buttons which has items to show only Distinct items in gallery (e.g Approve, reject and all buttons)

@WarrenBelz 

 

Just last one thing sir ,

 

Why when i click all button i can not see any record? it shows bank screen 

 

please see the formula used as per your guidance 

ON items of Gallery:

 

If(StatusResult <> "ALl", Filter('Petty Cash', 'Status ' = StatusResult), 'Petty Cash')

 

OnButtons:

UpdateContext({StatusResult: "Rejected"}) = RejectedBTn

UpdateContext({StatusResult:"Pending"}) = PendingBtn

UpdateContext({StatusResult: "Approved"}) = ApproveBtn

UpdateContext({StatusResult:"All"}) = Allbtn

 

Any suggestions?

 

Highlighted
Responsive Resident
Responsive Resident

Re: How create a buttons which has items to show only Distinct items in gallery (e.g Approve, reject and all buttons)

No issues i got the correction it was my mistake with capital and small letters of ALL btn. THanks 

Highlighted
Post Prodigy
Post Prodigy

Re: How create a buttons which has items to show only Distinct items in gallery (e.g Approve, reject and all buttons)

@WarrenBelz 

 

I did exact the same as you instructed.

 

But Unfortunately i am getting an error message.

 

If you could look into that please.

 

akbarmahfuzalam_0-1603488991491.png

where I am missing.

 

Highlighted
Super User III
Super User III

Re: How create a buttons which has items to show only Distinct items in gallery (e.g Approve, reject and all buttons)

@akbarmahfuzalam ,

This is an old closed post.

Please create a new thread and set out the all the code and process you are using.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,067)