web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Why is delegation not ...
Power Apps
Answered

Why is delegation not working on this app using CDS data

(1) ShareShare
ReportReport
Posted on by Microsoft Employee

I probably am just not understaning how delegation works, so please let me know! I have an app using a CDS for the data, which should be delegable by my understanding. The CDS is a large list of products for a chain fo retail convenient stores. I have a home page where you choose the store# (StoreNum) from a dropdown called Dropdown1. You then click a button with the OnSelect code of: 

Navigate(BrowseScreen1,ScreenTransition.Fade,{SelectedStore: Dropdown1.Selected.Value})

On BrowseScreen1 BrowseGallery1 has the Items code of:

Sort(Filter(If(IsBlank(TextSearchBox1.Text), Products, Filter(Products, TextSearchBox1.Text in Text(ItemNameWeight))), SelectedStore = StoreNum), ItemNameWeight, Ascending)

So basically the user chooses a StoreNum on the first page, and then when they search the gallery, all they see are results from that store. It only works for the first 500 records of the CDS though, which happens to be store# 218. If I choose store 218 and then search "Coke", I get 18 records in the gallery, which means that it is only returning the 18 "Coke" products that appear in the first 500 records. (there should be 24 total) If I choose a different StoreNum, then the gallery is blank, since there are no other stores in the first 500 records.

 

I believe that IF statements are not delegable, so I tried removing the If statement fom the above code like this:

Sort(Filter(Products, TextSearchBox1.Text in Text(ItemNameWeight)), ItemNameWeight, Ascending)

That still only searched the 500 items. I also tried removing the StoreNum restriction, so that the gallery should search all records, but still only 500 items.

 

What am I doing wrong? Is there a trick to get the app to work with delegation? Or is there something else that I'm doing that is not delegable?  

 

 

Categories:
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I can't answer your question as I have the same one - here's hoping someone answers for the both of us...

     

    😉

  • v-micsh-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

     

    Have you checked the article below?

    Understand delegation

    Which explains the current limitation of delegation, and the workable functions.

     

    I think the issue here should be the following part:

    TextSearchBox1.Text in Text(ItemNameWeight)

    Besides, is the ItemNameWeight a Number column?

    There should be the blue remindings tolding:

    "Part of this formula cannot be evaluated remotely, Right side of the in operator is not a column name"

    Or something similar to that.

    Instead, please take a try to search with a Text column, which should work with delegation.

    For functions worked, you may consider switch to Startwith instead of in operator when working with text column type.

     

    Regards,

    Michael

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi Michael,

        I had read that article, but now that I've read it again I see that the blue circle was telling me my error as you suspected. ItemNameWeight is actually a text column, so all I needed to do was remove the "Text()" portion of the code. The working code is:

     

    Sort(Filter(If(IsBlank(TextSearchBox1.Text), Products, Filter(Products, TextSearchBox1.Text in ItemNameWeight)), SelectedStore = StoreNum), ItemNameWeight, Ascending)

     

    I'm getting some odd results though. If I choose store "105", and on the gallery page I search "coke", then two records show up. ("Coke Diet 12 oz" and "Coke Zero 12 oz") If I add the word "diet" after "coke", then I get 5 records, which is correct. There are 18 total products that begin with the word "coke" at this store. If I choose store "109" and search "coke" then I see all 18 records as expected. Any tips on how to debug that one?

     

    Thanks for the help!

    Tony

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 312

#3
Mohsin Ali Profile Picture

Mohsin Ali 252

Last 30 days Overall leaderboard