cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ppblab77
Frequent Visitor

add filter to gallery based on Dropdown and toggle

hello,

I have the typical help desk application and I can already do filters based on a dropdown (which is based on the status of the request). Now I want to add a filter that adds to it (according to its state) based on a toggle. Depending on the state of this, I want to show or not the elements that are assigned to me (to the person ( isadmin) who is using the app at that moment).

In my gallery, in the "items" section I currently have this code.

***************

If
(isAdmin;
Sort
(Filter(AllTickets;TaskStatus.Value = Dropdown1.Selected.Value );
Created;Descending);
Sort
(Filter(AllTickets;Author.Email = MyProfile.Mail And TaskStatus.Value = Dropdown1.Selected.Value || Author.Claims = MyProfile.UserPrincipalName );
Created;Descending )
)

****************

ppblab77_2-1653602551429.png

 

ppblab77_0-1653602431949.png

column sharepoint

ppblab77_1-1653602496588.png

 

thanks!!

regards

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @ppblab77 ,

I am not entirely sure on your logic here, and also what value AssignedTo needs to match, but this would be the structure - the bracketing and &&/|| could change depending on the output you need.

Sort(
   Filter(
      AllTickets;
      (
         IsAdmin ||
         (
             Author.Email = MyProfile.Mail ||
             Author.Claims = MyProfile.UserPrincipalName
         ) 
      ) &&
      (
         !Toggle1.Value ||
         AssignedTo.DisplayName = MyProfile.UserPrincipalName
      ) &&
      TaskStatus.Value = Dropdown1.Selected.Value
   );
   Created;
   Descending
);

 

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.

Visit my blog Practical Power Apps

View solution in original post

4 REPLIES 4
WarrenBelz
Super User
Super User

Hi @ppblab77 ,

I am not entirely sure on your logic here, and also what value AssignedTo needs to match, but this would be the structure - the bracketing and &&/|| could change depending on the output you need.

Sort(
   Filter(
      AllTickets;
      (
         IsAdmin ||
         (
             Author.Email = MyProfile.Mail ||
             Author.Claims = MyProfile.UserPrincipalName
         ) 
      ) &&
      (
         !Toggle1.Value ||
         AssignedTo.DisplayName = MyProfile.UserPrincipalName
      ) &&
      TaskStatus.Value = Dropdown1.Selected.Value
   );
   Created;
   Descending
);

 

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.

Visit my blog Practical Power Apps

hello,

first thank you. I think you have understood my question very well.

I applied it and I only get an error, but I think I'm on the right track.

 

ppblab77_0-1653605729533.png

incompatible types for comparison. cannot compare these types: record, text

 

tanks!!!!!🙂

@ppblab77 ,

See corrected post in this area

I had just solved it by calling a text type column and cloning it with the low that is triggered when it is modified.

But your solution is much better, in my case it was .email

Thanks friend!!!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

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.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (4,034)