cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bhu128
Advocate I
Advocate I

Filter Gallery on Item's Status using a button

Hello,

I have set up a gallery from a Sharepoint list. The list (RequestList) has a column titled Decision Status. The column is a Single Text column. I want my user to be able to click one of four buttons to decide which status to view. I am also only allowing the user to view items on which they are the listed supervisor (Supervisor).

 

App OnStart: Set(varUser, User().FullName);

 

For my buttons:

  • Pending: OnSelect = Set(SelectedStatus,"Pending")
  • Approved: OnSelect = Set(SelectedStatus,"Approved")
  • Denied: OnSelect = Set(SelectedStatus,"Denied")
  • All: OnSelect = Set(SelectedStatus,"All")

 

For my gallery -- Items: 

 

Filter(RequestList,Supervisor = varUser &&
       If(
          !IsBlank(SelectedStatus) && SelectedStatus = "Pending",
          'Decision Status' = "Pending",
          .IsBlank(SelectedStatus) && SelectedStatus = "Approved",
          'Decision Status' = "Approved",
          !IsBlank(SelectedStatus) && SelectedStatus = "All",
          true
       ))
 

 

 

 

However, I get a delegation warning on my If formula, and also...nothing happens when I push a button. I really appreciate any help or ideas! Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions

@bhu128

Hopefully I am understanding your app correctly.  I believe SelectedStatus is a SET variable that stores a text string which can be one of "Pending", "Approved", "Declined" or "All".  'Decision Status' is a single line text column in SharePoint.

 

Please try this code and let me know the result.  Share a screenshot of any error messages.

Filter(
    RequestList,
    Supervisor = varUser,
    'Decision Status' = SelectedStatus 
    Or 'DecisionStatus' = "All"
)

 

I missed the Items code in your initial post.  Sorry for that.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

View solution in original post

4 REPLIES 4
mdevaney
Super User III
Super User III

@bhu128 

Can you please post a screenshot of your app?  This would help me to viusalize the problem.

 

What did you put in the Items property of the gallery?

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Gallery's Items is:

 

Filter(RequestList,Supervisor = varUser &&
       If(
          !IsBlank(SelectedStatus) && SelectedStatus = "Pending",
          'Decision Status' = "Pending",
          .IsBlank(SelectedStatus) && SelectedStatus = "Approved",
          'Decision Status' = "Approved",
          !IsBlank(SelectedStatus) && SelectedStatus = "All",
          true
       ))

 

 

Below is a screenshot, the lefthand column is my gallery that should display items based on the button selected.

 

20200213screenshot.png

@bhu128

Hopefully I am understanding your app correctly.  I believe SelectedStatus is a SET variable that stores a text string which can be one of "Pending", "Approved", "Declined" or "All".  'Decision Status' is a single line text column in SharePoint.

 

Please try this code and let me know the result.  Share a screenshot of any error messages.

Filter(
    RequestList,
    Supervisor = varUser,
    'Decision Status' = SelectedStatus 
    Or 'DecisionStatus' = "All"
)

 

I missed the Items code in your initial post.  Sorry for that.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

View solution in original post

Thank you! Now it works perfectly. I appreciate the help!!

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

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

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (99,745)