Hello there,
I need your help for my App.
On the Data, Items property of my gallery (Excel file, multiple columns containing text), I firstly applied a formula that by default showed all items but with a search function allowing the user to look for specific items by typing a text in a searchcase (textinput label).
SortByColumns(Search(Table1, TextInput.Text,"Column1", "Column2", "Column3"), "Column1", If(SortDescending1, Descending, Ascending))
The problem is we had too many results because the search function searches anywhere within the columns. I could use Startswith function but it would narrow down the results too much.
So, what I want to achieve is start with a Startswith function on 1 column (Column1) and if we get no result apply the search function on all columns (Column1, Column2, Column3).
My code would be the following but doesn't work. Could you help me please. I don't know what i'm getting wrong :
If(IsEmpty(Filter(Table1, StartsWith(Column1, TextInput.Text))), Search(Table1,TextInput.Text, "Column1", "Column2", "Column3"))
Thanx
I made i test with the following which works:
If(CountRows(Filter(Applcication, StartsWith(Employee, TextInput3.Text)))=0,
Search(Applcication,TextInput3.Text, "Department", "Description", "Customer"),
Filter(Applcication, StartsWith(Employee, TextInput3.Text)))
------------
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.
Hello eka24,
Your code works but what I want to achieve is now clearer.
I would like the gallery to display all items, sorted on the column "Afkorting", with a search function based on a textinput label and searching in 3 columns (Afkorting, Abréviation, Woorduitleg). Following code do the trick perfectly.
SortByColumns(Search(Table1, TextInput.Text,"Afkorting", "Abréviation", "Woorduitleg"), "Afkorting", If(SortDescending1, Descending, Ascending))
But I would like the gallery to show first items corresponding the most to the text of the search. See example below, i typed "BAGP" in the search box. Three items contain the text BAGP (here : 1BAGP, ABAGP & BAGP). The third item for example matches completely the request but appears only on third position. I would like it to be the first item displayed, than the others.
Any idea how to achieve this ?
What you are trying to do is to sort the Table based on what you enter in the TextBox. Am not aware of this could be achieved.
------------
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.
User | Count |
---|---|
251 | |
106 | |
96 | |
50 | |
39 |