cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Alex_Reig
Helper III
Helper III

Search data by writing a part of the text not only the begining

Hi all,

 

I have created a power app where I want to search data by writing only a part of the text in the searching field but now it only appears if I write the beginning of the text due to in the formula, I have StartsWith.

 

SortByColumns(Filter('Imputar horas'; StartsWith(Cliente.Value; TextSearchBox1.Text);'Creado por'.Email = User().Email); "Fecha"; If(SortDescending1; Descending; Ascending))

 

Alex_Reig_1-1637769328393.png

 

For example, I want to search all the registers that have across I have to write Across but I want to also see this registers if I write Health or hea or another part of the text.

 

What is the formula that I have to put instead of StartsWith?

 

Thank you very much,

Àlex Reig

1 ACCEPTED SOLUTION

Accepted Solutions
C-Papa
Super User
Super User

Hi, you need to use 'in' as shown below, if you are using SharePoint, this will give a delegation warning

 

SortByColumns(Filter('Imputar horas'; TextSearchBox1.Text in Cliente.Value;'Creado por'.Email = User().Email); "Fecha"; If(SortDescending1; Descending; Ascending))

View solution in original post

6 REPLIES 6
C-Papa
Super User
Super User

Hi, you need to use 'in' as shown below, if you are using SharePoint, this will give a delegation warning

 

SortByColumns(Filter('Imputar horas'; TextSearchBox1.Text in Cliente.Value;'Creado por'.Email = User().Email); "Fecha"; If(SortDescending1; Descending; Ascending))

RandyHayes
Super User
Super User

@Alex_Reig 

You will need to use the Search function to perform the type of search you want.  However, keep in mind that Search is not delegable and will not work on large data sources properly.

However, you have a "narrowing filter" in your formula, so you can leverage that with the Search function to avoid delegation issues.  

Your formula would be such as this:

With({_items: 
    Filter('Imputar horas'; 'Creado por'.Email = User().Email)
    };
    SortByColumns(
        Search(_items; TextSearchBox1.Text; Cliente.Value);
        "Fecha"; 
        If(SortDescending1; Descending; Ascending)
    )
)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
RandyHayes
Super User
Super User

@Alex_Reig 

Cross posted with @C-Papa !  That formula will have the same delegation issues when using the in operator.  You can structure as shown in my formula that uses search to use in if you would rather use the in operator.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Thank you @C-Papa  🙂

 

It worked

Hi @RandyHayes 

Thank you for answering 🙂

 

I tried your formula but Power app show me that there was a problem with Search

RandyHayes
Super User
Super User

@Alex_Reig 

No problem.  I am seeing that you have a Cliente.Value that you are trying to search - so that is not a Text column.  Didn't notice at first.

So with that particular Choice or Lookup column, there are a couple ways to go about using search on it, but the reality is that the in operator will do the trick also if it is just that column you are looking to search.

But to incorporate that into your formula and not get the delegation warning, your formula should be:

 

With({_items: 
    Filter('Imputar horas'; 'Creado por'.Email = User().Email)
    };
    SortByColumns(
        Filter(_items; TextSearchBox1.Text in Cliente.Value);
        "Fecha"; 
        If(SortDescending1; Descending; Ascending)
    )
)

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

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