Question: Is it possible to use the If() statement inside a Search() function?
I start with a basic search:
SortByColumns(Search([@'MyTable'],TextSearchBox1.Text,"Title"),"Title",If(SortDescending1,Descending,Ascending))
[Note: I realize there is a delegation issue...].
What I want to do is substitute an "if()" statement for "[@'MyTable']", which:
I can't tell if A) use of "if()" in a search formula is not allowed or B) I just have a syntax error somewhere.
Solved! Go to Solution.
Hi @bassman99 ,
Try this
SortByColumns(
Filter(
[@'MyTable'],
Len(TextSearchBox1.Text) = 0 ||
TextSearchBox1.Text in Title
),
"Title",
If(
SortDescending1,
Descending,
Ascending
)
)
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.
Visit my blog Practical Power Apps
Hi @bassman99 ,
Try this
SortByColumns(
Filter(
[@'MyTable'],
Len(TextSearchBox1.Text) = 0 ||
TextSearchBox1.Text in Title
),
"Title",
If(
SortDescending1,
Descending,
Ascending
)
)
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.
Visit my blog Practical Power Apps
That's *IT*! The "trick" is to use and/or with Filter, not an if() statement! My final formula was this:
SortByColumns(
Filter(
[@'MyTable'],
(Len(TextSearchBox1.Text) = 0 || TextSearchBox1.Text in Title),
(Len(ComboBox_Request_Status.Selected.Value) = 0 || Request_Status=ComboBox_Request_Status.Selected.Value)
),
"Title",
If(
SortDescending1,
Descending,
Ascending
)
)
Thanks!!
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
User | Count |
---|---|
184 | |
95 | |
62 | |
59 | |
58 |
User | Count |
---|---|
246 | |
165 | |
91 | |
76 | |
70 |