This seems so simple, but I cant get it to work. I want to sort my gallery alphabetically by title. I have a text input with a search feature currently. My current code is:
Search([@BOP],txtBOPSearch.Text,"Title","CourseID_x0028_CO_x0029_")
I have tried to merge the following code:
SortByColumns(Filter([DataSource], [Formula]), "Title1", If(SortDescending1, Descending, Ascending))
My end result was:
SortByColumns(Search([@BOP],txtBOPSearch.Text,"Title","CourseID_x0028_CO_x0029_"), "Title", If(SortDescending1, Descending, Ascending))
but I get an error about an invalid IF argument. How should this code appear?
Solved! Go to Solution.
If you only want A-Z, then just set the formula to:
SortByColumns(
Search([@BOP],
txtBOPSearch.Text, "Title", "CourseID_x0028_CO_x0029_"
),
"Title"
)
What kind of column is CourseID_x0028_CO_x0029_?
Your Formula is correct, but if the above column is not a text column, then the error is really on your Search function as it can only operate on text columns.
I hope this is helpful for you.
Hi @JTischler ,
There is nothing wrong with the last piece of code provided, but the error may suggest you do not have a control somewhere setting SortDescending
You could also try this
Search(
Sort(
[@BOP],
Title,
If(
SortDescending1,
Descending,
Ascending
),
txtBOPSearch.Text,
"Title",
"CourseID_x0028_CO_x0029_"
)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
"Nevermind" read it wrong in e-mail.
Yes...I was also assuming that you have an actual variable- SortDescending1 being defined somewhere in your app.
I do not have the SortDescending1 defined anywhere. I have seen it in a few code snippets, and assumed it was a syntax vs a variable.
Yes the CourseID_x0028_CO_x0029_ is a text field and the search is functioning fine. I just want it to sort the gallery alphabetical by title.
Ah, there ya go. You need that variable set to either true or false based on your formula.
Do you want the ability to sort A-Z as well as Z-A?
@RandyHayes where would I set that variable at?
Syntax: Set(SortDescending1,True)??
I just want to sort A-Z
If you only want A-Z, then just set the formula to:
SortByColumns(
Search([@BOP],
txtBOPSearch.Text, "Title", "CourseID_x0028_CO_x0029_"
),
"Title"
)
Lol I knew it was something simple!!!! Thanks so much 🙂
User | Count |
---|---|
253 | |
106 | |
92 | |
47 | |
37 |