I'm not sure if this is an issue with delegation, an issue with the formula (I don't think so), or just the way Powerapps will work, but if anyone can offer up any info that you might have I'd appreciate it.
I'm filtering a CDS of Products. It is a large CDS with thousands of records. My filter code is:
Sort(Filter(If(IsBlank(TextSearchBox1.Text), Products, Filter(Products, TextSearchBox1.Text in ItemNameWeight)), SelectedStore = StoreNum), ItemNameWeight, Ascending)
You'll see above that the search field filters the product name, "ItemNameWeight", for a specific store "StoreNum". The issue I'm finding is that if I choose a store and search "Coke", then I should get back 18-24 records of products with Coke in the title. (Coke Diet 12oz, Coke Cherry 12oz, Coke 12oz, etc.)
For some stores it returns the results immediately and accurately, but for some stores it returns a blank gallery. If I then keep typing, "Coke D", then it returns 5 products with "Coke Diet" in the title, which is correct. One store (so far), when I search "Coke", will return two records, "Coke Diet" and "Coke Zero", but if I again add a space and "D", then it returns the 5 Coke Diet records. In this example I have no way to return all products with "Coke" in the name. Again, many of the stores will return 24 Coke products immediately, so it seems random.
It doesn't seem to make any logical sense that I can figure out. Is there any ongoing issue or tips that someone can give me? Is this just a biproduct of how Powerapps works with large CDSs?
I think this should be caused by the 'in' operator.
Please consider switch the formula as below:
Sort(Filter(If(IsBlank(TextSearchBox1.Text), Products, Filter(Products, Startswith(ItemNameWeight, TextSearchBox1.Text))), SelectedStore = StoreNum), ItemNameWeight, Ascending)
Use the Startswith function instead of the in operator.
See if that would work as you expected.
Thanks for the help. Unfortunately, I get a blue dot that advises that the formula can't be evaluated remotely due to service limitations. Even though StartsWith is a delegable function, it seems to not like that unfortunately. Also, I'd rather keep the ability to find a word anywhere in the product name. If Diet Coke is entered as "Coke Diet 12 oz" or "Diet Coke 12oz" it would be much more user friendly to show either.
I just tried the formula similar like yours, and there is no blue remindings occurred on my side:
Tested with Common Data Service Contact entity:
Would you please check it again?
I tried it again, and I've analyzed it over and over again, but I don't see the error. I still get the blue dot. Here is the screen shot...
Please add double quotes with the ItemNameWeight within Startswith function, see if that would help.
Change your formula with the format below:
SortByColumns(Filter(Testing2, StartsWith("MText",TextSearchBox1.Text)), "CreatedByUser", If(SortDescending1, Descending, Ascending))
I wrote the following code based on your suggestion:
SortByColumns(Filter(Products, StartsWith("ItemNameWeight", TextSearchBox1.Text)), "ItemNameWeight", If(SortDescending1, Descending, Ascending))
That doesn't have any errors or blue dots, but it returns a blank gallery. If I remove the quotes from ItemNameWeight in the StartsWith function, then it only works locally within the 500 records. Any other thoughts or have I stumpted you 🙂
Learn how to create your own user groups today!
Check out the new Power Platform Community Connections gallery!
Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.