cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KimberlyM
Level 8

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
Community Support Team
Community Support Team

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.
KimberlyM
Level 8

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
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

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