cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
james_riach
Level: Powered On

Delegation Formula Help

 

Hello,

 

I have a PowerApp which has been built and is in use currently in our company but we are likely to reach the 2000 delegation limit shortly so I have been trying to look into a way to adjust the formula used to avoid delegation. Unfortunately I have had no joy in creating a working method to still sort and filter on what we need but avoid delegation too. Any help on this would be much appreciated.

 

Please see the code we are currently using below:

 

SortByColumns(
  Filter(
    Filter(
      Filter(
        Sort(
          Sort(
            Sort(
              Sort(
                'LFF UK IT Task List',
                Text('Sub Theme'.Value)
            ),
           Text('Business Theme'.Value)
        ),
       Text(Dept.Value)
       ),
       Text(Sponsor.Value),
       Ascending
     ),
     If(
         ViewDrp.SelectedText.Value = "All Items",
         true,
         ViewDrp.SelectedText.Value in Status.Value
      ) || If(
         ViewDrp.SelectedText.Value = "All Live",
         Status.Value <> "06. Complete" && Programme.Value = "No",
         ViewDrp.SelectedText.Value in Status.Value
      ) || If(
        ViewDrp.SelectedText.Value = "Live AB",
        Status.Value <> "06. Complete" && "AB" in 'Who Int'.Value && Programme.Value = "No",
        ViewDrp.SelectedText.Value in 'Who Int'.Value
      ) || If(
        ViewDrp.SelectedText.Value = "Live AF",
        Status.Value <> "06. Complete" && "AF" in 'Who Int'.Value && Programme.Value = "No",
        ViewDrp.SelectedText.Value in 'Who Int'.Value
      ) || If(
        ViewDrp.SelectedText.Value = "Live CC",
        Status.Value <> "06. Complete" && "CC" in 'Who Int'.Value && Programme.Value = "No",
        ViewDrp.SelectedText.Value in 'Who Int'.Value
      ) || If(
        ViewDrp.SelectedText.Value = "Live JH",
        Status.Value <> "06. Complete" && "JH" in 'Who Int'.Value && Programme.Value = "No",
        ViewDrp.SelectedText.Value in 'Who Int'.Value
      ) || If(
        ViewDrp.SelectedText.Value = "Live JS",
        Status.Value <> "06. Complete" && "JS" in 'Who Int'.Value && Programme.Value = "No",
        ViewDrp.SelectedText.Value in 'Who Int'.Value
      ) || If(
        ViewDrp.SelectedText.Value = "Live MN",
        Status.Value <> "06. Complete" && "MN" in 'Who Int'.Value && Programme.Value = "No",
        ViewDrp.SelectedText.Value in 'Who Int'.Value
      ) || If(
        ViewDrp.SelectedText.Value = "Live SH",
        Status.Value <> "06. Complete" && "SH" in 'Who Int'.Value && Programme.Value = "No",
        ViewDrp.SelectedText.Value in 'Who Int'.Value
      )
    ),
    Status.Value in StatusCombo.SelectedItems.Value
   ),
    TextSearchBox1.Text in 'IT ID' || TextSearchBox1.Text in 'Project/Task'
 ),
  SortColumn,
  If(
     SortDecending,
     Ascending,
     Descending
  )
)

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Delegation Formula Help

Hi @james_riach ,

Could you please share a bit more about the 'LFF UK IT Task List' data source? Is it a SP List?

 

Based on the screenshot that you mentioned, I think this issue is related to the 'Sub Theme' field (Choice type field) in your SP List data source.

 

Currently, the Choice type field is not delegable within Sort function. Please check the following article for more details:

https://docs.microsoft.com/en-us/connectors/sharepointonline/#powerapps-data-type-mappings

 

If you want to get rid of the Delegation warning issue within your formula, I afraid that there is no direct way to achieve your needs in PowerApps currently.

As an alternative solution, you could consider create a Calculated field for each Choice type field in your 'LFF UK IT Task List' SP List. Set the Formula box for each Calculated field to following:

=[Sub Theme]
=[Business Theme]

...

Then within your formula, please use the Calculated field as Sort column within your Sort formula intead of the original Choice type fields, then check if the issue is solved.

 

Also please check and see if the alternative solution I provided within the following thread would help in your scenario:

https://powerusers.microsoft.com/t5/Building-PowerApps-Formerly/Sort-gallery-with-multiple-fields/td...

 

Please consider take a try with the following workaround, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

10 REPLIES 10
Super User
Super User

Re: Delegation Formula Help

@james_riach 

I do not know the solution but we can start by cleaning up the code a bit.  I found it very difficult to read.  Here's what a segment of your looks like.

 

If(
ViewDrp.SelectedText.Value = "All Items",
true,
ViewDrp.SelectedText.Value in Status.Value
) || If(
ViewDrp.SelectedText.Value = "All Live",
Status.Value <> "06. Complete" && Programme.Value = "No",
ViewDrp.SelectedText.Value in Status.Value
) || If(
ViewDrp.SelectedText.Value = "Live AB",
Status.Value <> "06. Complete" && "AB" in 'Who Int'.Value && Programme.Value = "No",
ViewDrp.SelectedText.Value in 'Who Int'.Value
) || If(
ViewDrp.SelectedText.Value = "Live AF",
Status.Value <> "06. Complete" && "AF" in 'Who Int'.Value && Programme.Value = "No",
ViewDrp.SelectedText.Value in 'Who Int'.Value
) || If(
ViewDrp.SelectedText.Value = "Live CC",
Status.Value <> "06. Complete" && "CC" in 'Who Int'.Value && Programme.Value = "No",
ViewDrp.SelectedText.Value in 'Who Int'.Value
) || If(
ViewDrp.SelectedText.Value = "Live JH",
Status.Value <> "06. Complete" && "JH" in 'Who Int'.Value && Programme.Value = "No",
ViewDrp.SelectedText.Value in 'Who Int'.Value
) || If(
ViewDrp.SelectedText.Value = "Live JS",
Status.Value <> "06. Complete" && "JS" in 'Who Int'.Value && Programme.Value = "No",
ViewDrp.SelectedText.Value in 'Who Int'.Value
) || If(
ViewDrp.SelectedText.Value = "Live MN",
Status.Value <> "06. Complete" && "MN" in 'Who Int'.Value && Programme.Value = "No",
ViewDrp.SelectedText.Value in 'Who Int'.Value
) || If(
ViewDrp.SelectedText.Value = "Live SH",
Status.Value <> "06. Complete" && "SH" in 'Who Int'.Value && Programme.Value = "No",
ViewDrp.SelectedText.Value in 'Who Int'.Value
)

 

You can change it into this code which I feel is easier to interpret

 

If(
    ViewDrp.SelectedText.Value in ["All Items","All Live","Live AB","Live AF","Live CC","Live JH","Live JS","Live MN","Live SH"],
    Status.Value <> "06. Complete" && Programme.Value = "No",
    ViewDrp.SelectedText.Value in Status.Value
) || 
If(
    ViewDrp.SelectedText.Value = "All Items",
    true,
    ViewDrp.SelectedText.Value in Status.Value
)

 

Any chance you can post a properly indented version of your code?  That's what made it hard for me to understand...

james_riach
Level: Powered On

Re: Delegation Formula Help

SortByColumns(
    Filter(
        Filter(
            Filter(
                Sort(
                    Sort(
                        Sort(
                            Sort(
                                'LFF UK IT Task List',
                                Text('Sub Theme'.Value)
                            ),
                            Text('Business Theme'.Value)
                        ),
                        Text(Dept.Value)
                    ),
                    Text(Sponsor.Value),
                    Ascending
                ),
                If(
                    ViewDrp.SelectedText.Value = "All Items",
                    true,
                    ViewDrp.SelectedText.Value in Status.Value
                ) || If(
                    ViewDrp.SelectedText.Value = "All Live",
                    Status.Value <> "06. Complete" && Programme.Value = "No",
                    ViewDrp.SelectedText.Value in Status.Value
                ) || If(
                    ViewDrp.SelectedText.Value = "Live AB",
                    Status.Value <> "06. Complete" && "AB" in 'Who Int'.Value && Programme.Value = "No",
                    ViewDrp.SelectedText.Value in 'Who Int'.Value
                ) || If(
                    ViewDrp.SelectedText.Value = "Live AF",
                    Status.Value <> "06. Complete" && "AF" in 'Who Int'.Value && Programme.Value = "No",
                    ViewDrp.SelectedText.Value in 'Who Int'.Value
                ) || If(
                    ViewDrp.SelectedText.Value = "Live CC",
                    Status.Value <> "06. Complete" && "CC" in 'Who Int'.Value && Programme.Value = "No",
                    ViewDrp.SelectedText.Value in 'Who Int'.Value
                ) || If(
                    ViewDrp.SelectedText.Value = "Live JH",
                    Status.Value <> "06. Complete" && "JH" in 'Who Int'.Value && Programme.Value = "No",
                    ViewDrp.SelectedText.Value in 'Who Int'.Value
                ) || If(
                    ViewDrp.SelectedText.Value = "Live JS",
                    Status.Value <> "06. Complete" && "JS" in 'Who Int'.Value && Programme.Value = "No",
                    ViewDrp.SelectedText.Value in 'Who Int'.Value
                ) || If(
                    ViewDrp.SelectedText.Value = "Live MN",
                    Status.Value <> "06. Complete" && "MN" in 'Who Int'.Value && Programme.Value = "No",
                    ViewDrp.SelectedText.Value in 'Who Int'.Value
                ) || If(
                    ViewDrp.SelectedText.Value = "Live SH",
                    Status.Value <> "06. Complete" && "SH" in 'Who Int'.Value && Programme.Value = "No",
                    ViewDrp.SelectedText.Value in 'Who Int'.Value
                )
            ),
            Status.Value in StatusCombo.SelectedItems.Value
        ),
        TextSearchBox1.Text in 'IT ID' || TextSearchBox1.Text in 'Project/Task'
    ),
    SortColumn,
    If(
        SortDecending,
        Ascending,
        Descending
    )
)
james_riach
Level: Powered On

Re: Delegation Formula Help

Sorry, how is that now?

Super User
Super User

Re: Delegation Formula Help

@james_riach 

Much easier to read, thanks! Is any section of your code being highlighted in the editor to show where the delegation issue is?

james_riach
Level: Powered On

Re: Delegation Formula Help

Hello @mdevaney ,

 

If I'm honest, most of the formula is throwing delegation warnings but it will only show me the next delegation warning if I delete the first warning. It doesn't show me all the delegation warnings at once for some reason.

 

Please see image below.

 

james_riach_0-1572449330816.png

Super User
Super User

Re: Delegation Formula Help

 

@james_riach 

I think I understand what is going on now.  A picture truly is worth one-thousand words.  Is SubTheme a LookUp column in Sharepoint?  A LookUp column is a complex column type and it cannot be sorted.

 

Please let me know

 

MS Docs about Sharepoint Delegation

https://powerapps.microsoft.com/en-us/blog/sharepoint-delegation-improvements/

 

---
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."

james_riach
Level: Powered On

Re: Delegation Formula Help

Hi @mdevaney 

 

The sub theme column is a choice field in SharePoint. All the columns referenced are choice fields in SharePoint. Does that make any difference?

 

Thanks,

Super User
Super User

Re: Delegation Formula Help

 

@james_riach 

...deleted...

 

Super User
Super User

Re: Delegation Formula Help

@james_riach 

Check out this post by @RezaDorrani for info on how to use Choices columns and delegation

 

https://powerusers.microsoft.com/t5/Building-PowerApps-Formerly/Delegation-Issue-Sort-and-If-Stateme...

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,249)