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

Filter Returns No Results Until More Text Is Added To Search

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?

6 REPLIES 6
v-micsh-msft
Community Support
Community Support

Hi @Anonymous,

 

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.

StartsWith function in PowerApps

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.
Anonymous
Not applicable

Hi Michael,

    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. 

 

Thanks,

 Tony

Hi @Anonymous,

 

Updated:

 

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:

70.PNG

Would you please check it again?

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.
Anonymous
Not applicable

Hi @v-micsh-msft

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

 

Screen Shot 2017-04-19 at 9.29.52 AM.png

Hi @Anonymous,

 

 

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))

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.
Anonymous
Not applicable

Hi @v-micsh-msft,

    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 🙂

 

Thanks again,

Tony

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,271)