Skip to main content

Notifications

Power Apps - Microsoft Dataverse
Answered

PowerApps - Delegable filters and Polymorphic fields

(0) ShareShare
ReportReport
Posted on by 8

Hi All,

 

I've run into a strange issue building an app that I can't get my head around.

 

Background

I have a custom table inside dataverse, called Logs.  Whenever a Power Automate flow runs to synchronize some data to an external system, if an error is encountered, then a Log record is written into dataverse.

 

On the Log table I have a polymorphic field called 'regarding'.  The Polymorphic field can link to the Accounts Table, or a Custom Table called 'Sites'.

 

This all works completely fine.

 

Problem

In a Canvas App I have two collections, in which I am trying to establish records that have had synchronization issues in the past.

 

So I have one collection for Accounts that have had Sync issues, and another for Sites that have had sync issues.

 

For my Accounts collection, I have used the following:

 

 

 

ClearCollect(
 colAccounts(
 AddColumns(
 "Sync Errors", CountRows(
 Filter(
 Logs,
 'Status Reason' = 'Status Reason (Logs)'.Error And
 AsType(Regarding,Accounts).Account = Account
 )
 )
 )
)

 

 

 

This works fine,  no problems at all.  However for my Sites Collection I am using:

 

 

 

ClearCollect(
 colSites(
 AddColumns(
 "Sync Errors", CountRows(
 Filter(
 Logs,
 'Status Reason' = 'Status Reason (Logs)'.Error And
 AsType(Regarding,new_sites).Site = Site
 )
 )
 )
)

 

 

 

Which is throwing delegation warnings, and as the data set grows I have started to see issues.

 

What is the issue here?  The construct is exactly the same between each collection, the only difference as I can see it is that one is based on an OOTB table, whereas the other is based on a custom table?

 

Is there any issues around delebale queries on custom tables that I'm unaware of?

 

Thanks in advance for any help, suggestions, or an alternative method to solve my problem. 

 

Regards,

 

Categories:
  • matt_piper Profile Picture
    matt_piper 8 on at
    Re: PowerApps - Delegable filters and Polymorphic fields

    Hi Wenjuan,

     

    Thanks for your reply, and it makes sense to a degree.  I have extended the delegation limit and to completely answer that part of your reply, there are currently less than 2000 records in each of the Accounts, and Sites table.

     

    I had expected however that I would get a delegation warning regardless of the actual number of records in the environment.  For example if a function is non-delegable, I would expect that warning to appear in an environment whwre there are only 5 records instead of 5000 records.  Non-delegable is non-delgable no matter the size of the data set.

     

    Further - if a function is non-delegable then I would hope that I get the warning regardless of the secondary table.  So In this example I would want and expect to see the same warning on both collections, as both are doing the exact same thing.  The inconsistency is frustrating and can lead you down the wrong path, ie

     

    "If example A works, and example B uses the exact same logic but doesn't work, then I must have a problem somewhere else..."

     

    In the end I have created an extra lookup field in the Log table that is populated for sites.  and the delegation issue disappears.  Not my preferred solution, but it gets me home. 

     

    Which leads me to further question why that would be the case.  If filtering a datasource on a lookup field that is polmorphic throws a delegation warning, but filtering the same datasource on a lookup that is not polymorphic does not, why is that the case?  The secondary table is the exact same table!

     

    Anyhow, my issue is resolved.  Thanks again for the reply, appreciate it!

  • Verified answer
    Re: PowerApps - Delegable filters and Polymorphic fields

    Hi @matt_piper ,

     

    AddColumns() partially support delegation. Formulas in their arguments can be delegated. However, the output of these functions are subject to the non-delegation record limit. Click here for details: Understand delegation in a canvas app - Power Apps | Microsoft Learn

     

    You may check the results of your filter() to see whether the outputs from Sites' hit the delegation limit.

    Not sure if you have extend your delegation limit or not. Maybe that will help you out of the dilemma. Refer to this link for guidance: Understand delegation in a canvas app - Power Apps | Microsoft Learn

     

    Community Support Team _ Wenjuan Zou

    If this post helps, then please consider Accept it as the solution to help the other members find it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,445

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,741

Leaderboard

Featured topics