web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Help with delegation
Power Apps
Answered

Help with delegation

(1) ShareShare
ReportReport
Posted on by Microsoft Employee

Hey guys!

So I have a gallery that is filtered and sorted with this formula:

SortByColumns(Filter( Registro, Tickets > 0 ),"Fecha",Descending)

I'm adding a textobox to search the gallery, named "searchbox" I need to search the "Registro" source and match with the "Tickets" column. I can't figure it out the correct order and also when I try the search function alone it gives me an error, "text was expected". But I do not know why, my textbox has value format and my column in the excel sheet has value format too.

Search(Registro, "Searchbox.Value", "Tickets")

 Can you help me?

Categories:
I have the same question (0)
  • eka24 Profile Picture
    20,925 on at

    Try:

    SortByColumns(Filter(Search( Registro, "Searchbox.Text", "Tickets"),Tickets > 0 ),"Fecha",Descending)

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @eka24 !

     

    It is giving me an error, it says "incorrect type of column. Text was expected" My column in the table is set to value, and my textbox too.

    SortByColumns(Filter(Search( Registro, "Searchbox.Text", "Tickets"),Tickets > 0 ),"Fecha",Descending)

    Any ideas?

  • Verified answer
    iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    Hi @Anonymous,

     

    Could you try:

    SortByColumns(
     Filter(
     Registro,
     Tickets > 0,
     (
     Len(SearchBox.Text) = 0
     ||
     Tickets = Value(SearchBox.Text)
     )
     ),
     "Fecha",
     Descending
    )

     

    Am I correct to assume the Tickets column is the ticket number?

     

    Cheers,

    Sancho

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @iAm_ManCat !

     

    Indeed you are correct to assume, and that did the trick, thank you so much!
    Just to understand a little bit, Why is it not detecting the format? What are the the Len and Value doing in the syntax?

    I'm really thankful!

  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    Hi @Anonymous 

     

    Happy to explain!

     

    Ok, so originally you had:

    SortByColumns(
     Filter(
     //DataSource
     Registro,
    
     //Condition
     // your condition here is that the
     // ticket number is greater than zero,
     // so this will show all tickets
     Tickets > 0 ),
     "Fecha",
     Descending
    )

     

     

    Then we moved to the below, which was trying to Search
    (Search requires text column values, and is delegable but not with SharePoint😞

    SortByColumns(
     Filter(
     Search( Registro, "Searchbox.Text", "Tickets"),
     Tickets > 0
     ),
     "Fecha",
     Descending
    )

      

     

    What I've then done is:

     

    SortByColumns(
     Filter(
     Registro,
     // Condition number 1
     Tickets > 0
     // Commas in conditions are equal to AND
     ,
     // Start condition two,
     // which will contain two conditions
     (
     // Check that the Length of the Text in the SearchBox
     // is equal to zero, if yes then this whole condition 2
     // becomes just the value 'true'
     // This then makes the overall condition:
     // Tickets > 0 AND 'true'
     // which is just
     // Tickets > 0
     Len(SearchBox.Text) = 0
    
     // Then we use the || which stands for OR ( && stands for AND)
     // So we are saying that either the above statement is true
     // OR evaluate this second statement
     ||
     
     // This second statement Converts the SearchBox.Text to a number
     // That is what the Value function does, converts to number values
     // while you did set the content of the searchBox to a number,
     // the .Text property of the control is a Text value like "8"
     // so we convert that to a number and compare against the
     // Ticket value, but only if the there's anything in the textbox
     // (ie the length is more than zero)
     Tickets = Value(SearchBox.Text)
     )
     ),
     "Fecha",
     Descending
    )

     

    Let me know if there's anything in the comments there that doesn't make sense, happy to elaborate further 🙂

     

    Thanks,

    Sancho

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @iAm_ManCatThanks! Now I see, so the thing is that setting the format does not always be perceived as such by powerapps, also it doesn't work on share point, got it. That was the main thing(Also I need to practice the delegation thingy)

     

    May I bother you with one last thing? I was trying to do the same but now with a table, add a textbox to search the table, but now that you mention this, I wanted to try it but I could not.  Right now I have this one:

     

    SortByColumns(Filter( Registro, Tickets > 0 ),"Fecha",Descending)

     

    But now I want type a word(Not value) on the "searchbox2" to look on the table source "Registro" in column Bds, while continue to filter and bring Tickets with a value greater than 0. I added the function correctly but it brings 0 results, I think is because I have Filter and Search and Sort by Columns.

    SortByColumns(Filter(Search( Registro, "Searchbox2.Text", "Bds"),Tickets > 0 ),"Fecha",Descending)
  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    Hey @Anonymous 

     

    Yeah of course, happy to help and it should be easy for us to modify the one I gave earlier:

     

    SortByColumns(
     Filter(
     Registro,
     Tickets > 0,
     (
     Len(SearchBox2.Text) = 0
     ||
     StartsWith(Bds, SearchBox.Text)
     )
     ),
     "Fecha",
     Descending
    )

    This uses the StartsWiith command so it should search as you start typing 

     

     

    If that doesn't work could you try without the Column Sorting (my memory is telling me that I once had an issue with tables and column sorting but it might not be applicable now):

    Filter(
     Registro,
     Tickets > 0,
     (
     Len(SearchBox2.Text) = 0
     ||
     StartsWith(Bds, SearchBox.Text)
     )
    )

     

    If that doesn't work then please feel free to send back more details if it is showing any errors,

     

    Cheers,

    Sancho

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @iAm_ManCatThe first one did the trick, sort, filter and I can search, I'm so happy!

    Thank you so much, I need to practice these things, thank for you input and explanation. An of course for your time!

  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    You're welcome, happy to have helped 😺

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard