cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TimoMigchielsen
Post Prodigy
Post Prodigy

Delegation error & replacing StartsWith with Search

Hello there!

I get a delegation error trying to do 'Prod. usage' = "Bev M; Montage"

I then also want to replace the StartsWith line with the normal Search function. This is the code for that: 

 

    Distinct(
    Filter(
            Lijst_Eindp;
        StartsWith('Prod. usage';TekstZoekVeld_1.Text) || StartsWith(Omschrijving;TekstZoekVeld_1.Text)
    );Omschrijving)

 


This code is really confusing. It is supposed to Filter the column 'Prod usage' or Omschrijving based on what is filled in on the TextSearchField and then show the Omschrijving. 

Full code:

 

SortByColumns(
If(
   Checkbox2_1.Value = false && Checkbox2.Value = true; 
  If(
    IsBlank(TekstZoekVeld_1.Text);
    Distinct(Filter(
        Lijst_Eindp;
        'Prod. usage'="Bev M; Montage"); Omschrijving
    );
    Distinct(
    Filter(
            Lijst_Eindp;
        StartsWith('Prod. usage';TekstZoekVeld_1.Text) || StartsWith(Omschrijving;TekstZoekVeld_1.Text)
    );Omschrijving)
  );
   Checkbox2_1.Value = true && Checkbox2.Value = false; 
   If(
    IsBlank(TekstZoekVeld_1.Text);
    Distinct(Filter(Lijst_Eindp; 'Prod. usage'="Bev M; Montage" && Left(Bestandsnaam1; 5) = DataCardValue34.Text);Omschrijving);
    Distinct(Filter(Lijst_Eindp; 'Prod. usage'="Bev M; Montage" && Left(Bestandsnaam1; 5) = DataCardValue34.Text;StartsWith(Omschrijving;TekstZoekVeld_1.Text));Omschrijving)
   )
); "Result")

 

I think there might also be a delegation error using the Search function. I want to be able to search for something in the middle of the sentence for example, that's why I want to use Search. I am using SharePoint as database and it has 50.000 rows.

1 REPLY 1
RandyHayes
Super User III
Super User III

@TimoMigchielsen 

You will not be able to use Search as your primary filter - it is not delegable.

 

If you have a narrowing filter, you can then apply search to the results of that, but you cannot do it against the entire list.

 

In other words, if you can Filter Lijst_Eindp without the StartsWith or Search and reduce the number of results returned from that to be less than your record limit, then you can apply a search to those results to then return what you want.

 

Ex:

Search(
    Filter(yourList, narrowingCriteria),
    searchValue,
    searchColumns
)

 

I hope this is clear and 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.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (45,108)