cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
Helper IV

Sorting by Status and only displaying 2 of 4 types in a gallery

Good day,

 

I have been working on this problem, again, for some time (here is a link to my original post on this topic: https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Delegation-Issue-Sort-and-If-Statem...). I had been pointed to this tutorial as you will see in my code snippet the commented section of the code is what I have going currently but the second nested If Statement causes a delegation problem that will be a problem for my large database. 

Based on the the tutorial (found here: https://www.youtube.com/watch?v=pn50AKn3Q1Y&list=PLTyFh-qDKAiE6ia-D94Qk5-AzpN4dqOmD&index=4&t=0s) the new code displayed at the top of the code snippet is what I wrote. It is all error-ed out on me and I have no idea where to even start tackling this as I have gone at it in so many ways now I'm not sure what end it up! 

 

This code is on my gallery_dashboard on my Dashboard Screen. The dd_Status.Selected here pulls from my edit_form form on the Edit Screen. If I pull the status from the Dashboard Screen then the name of the field I would choose from is dash_status.text. This field is a choice column in my SharePoint List. 

Help me understand!?!

//New Code Based on Tutorial All Red Squiggly Not Sure Why
Sort(
    If(
        varAdmin,
        Filter(
            Lead_Data, Status.Value = dd_Status.Selected),
        Filter(
            Lead_Data,
            AssignedTo.Value = varUser || LeadMember1.Value = varUser || LeadMember2.Value = varUser || LeadMember3.Value = varUser || LeadMember4.Value = varUser,
            Status.Value = dd_Status.Selected),
    ),
Created, Descending);

// Current Code - Working with delegation issues
/*Sort(
   If(
   varAdmin,
   Filter(
      Lead_Data,
      If(
         SelectedStatus = "All",Or(Status.Value = "In Progress", Status.Value = "Not Started"),Status.Value = SelectedStatus
   )
),
   Filter(
      Lead_Data,
      AssignedTo.Value = varUser || LeadMember1.Value = varUser || LeadMember2.Value = varUser || LeadMember3.Value = varUser || LeadMember4.Value = varUser,
      If(
         SelectedStatus = "All",Or(Status.Value = "In Progress", Status.Value = "Not Started"),Status.Value = SelectedStatus
   )
)
),
Created, Descending)*/


@RezaDorrani you were helping me with this before so this is the reason I am tagging you

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: Sorting by Status and only displaying 2 of 4 types in a gallery

Hi @KimberlyM ,

 

Which part of the formula has the blue underline marked? Please also tell the involved columns' column types.

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper IV
Helper IV

Re: Sorting by Status and only displaying 2 of 4 types in a gallery

//New Code Based on Tutorial All Red Squiggly Not Sure Why
Sort(
If(
varAdmin,
Filter(
Lead_Data, Status.Value = dd_Status.Selected),
Filter(
Lead_Data,
AssignedTo.Value = varUser || LeadMember1.Value = varUser || LeadMember2.Value = varUser || LeadMember3.Value = varUser || LeadMember4.Value = varUser,
Status.Value = dd_Status.Selected),
),
Created, Descending);


// Current Code - Working to properly sort and pull information the way I want but with delegation issues
Sort(
If(
    varAdmin,
    Filter(
       Lead_Data,
       If(
          SelectedStatus = "All",Or(Status.Value = "In Progress", Status.Value = "Not Started"),Status.Value = SelectedStatus
       )
     ),
    Filter(
       Lead_Data,
       AssignedTo.Value = varUser || LeadMember1.Value = varUser || LeadMember2.Value = varUser || LeadMember3.Value = varUser || LeadMember4.Value = varUser,
       If(
          SelectedStatus = "All",Or(Status.Value = "In Progress", Status.Value = "Not Started"),Status.Value = SelectedStatus
       )
    )
),
Created, Descending)


Status is the column I am attempting to filter with. It is a choice field.

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,191)