cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Why is delegation not working on this app using CDS data

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?  

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Anonymous
Not applicable

Re: Why is delegation not working on this app using CDS data

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

View solution in original post

3 REPLIES 3
Highlighted
Anonymous
Not applicable

Re: Why is delegation not working on this app using CDS data

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

 

😉

Highlighted
Community Support
Community Support

Re: Why is delegation not working on this app using CDS data

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

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Anonymous
Not applicable

Re: Why is delegation not working on this app using CDS data

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

View solution in original post

Helpful resources

Announcements
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

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,974)