I'm trying to write a function whose goal is to find a number listed in the field below.
I've already tried putting the code/function as in the image, but it is not allowed or doesn't execute.
SortByColumns(Search(CustomGallerySample, TextSearchBox4.Text, "SampleText"), "SampleText", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))
Tks for support.
This is not how PowerApps works...please read my response to your same question in your other posting.
Looks like a circular reference to me.... You're setting the Default for a control (TextSearchBox4) to a value that is searching the value for that control...
However over the red circle or run the "App Checker" (stethescope icon) to verify the error...
Do you want to sort by one search box's text?
You can change your formula expression as this:
Sort(Search(CustomGallerySample, TextSearchBox4.Text, "SampleText"), "SampleText", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))
Hope this could be helpful.
Not sure if you saw the reply I gave you to this question in your other post, but here it is repeated for your convenience.
You need not worry about the Textbox to do anything. In PowerApps, things "respond" to other controls, controls don't usually alter other things.
So, looking at your original default formula for your Gallery Items Property is the place to start.
You can see that it had two functions in it - the SortByColumns and the Search function. You will need to apply those to your Gallery Items property as well.
Consider altering this formula for your needs:
SortByColumns( Search(yourDataSource, TextSearchBox4.Text, "yourColumnYouWantToSearchInQuotes"), "yourColumnYouWantToSortByInQuotes", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending) )
This will give you similar functionality for searching and sorting that you were asking for, but you need to apply your datasource and your columns.
This will be a conference that you do not want to miss!
Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.
Check out the winners of the recent 'Can You Solve These?' community challenge!
Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.
Featuring samples like Return to the Workplace and Emergency Response Applications
Features releasing from October 2020 through March 2021