I have a list that contains store names and the store number. I currently have a text search box that lets users enter the store name and it filters out to only show that name. My powerapp shows them all listed out and the search works correctly.
I would like to add the option so that users could choose to enter either the store name the store number and it would then filter out the correct store.
Currently my item for the gallery has:
SortByColumns(Filter([@'Store Locations'], StartsWith(Location, SearchInputBox.Text)), "Store", If(SortDescending1, Descending, Ascending))
Is it possible to add filter by the store number as well?
A second question - I currently have STARTS WITH(location... is there a way to say something like CONTAINS instead - so if the user types CITY and it is actually listed as N CITY then the correct store will still be found?
Thank you for your help
Becky
Solved! Go to Solution.
Hi @BeckyC
You could simply add another StartsWith() function separated with a ||.
Your formula could look like the following, while you'd need to replace <store ... field> with the corresponding field name:
SortByColumns(
Filter([@'Store Locations'],
StartsWith(<store name field>, SearchInputBox.Text) ||
StartsWith(<store number field>, SearchInputBox.Text)
) ,
"Store",
If(SortDescending1, Descending, Ascending)
)
As for contains, in Power Apps this is called in.
You can use this operator for example like so:
LookUp(<source>, city in cities).city
I hope this helps.
Hi @BeckyC ,
you can change your filter as below:
SortByColumns(Filter([@'Store Locations'], (StartsWith(Location, SearchInputBox.Text)), "Store" || StartsWith(Location, SearchInputBox.Text)), "storenumber"), If(SortDescending1, Descending, Ascending))
unfortunately, PowerApps doesn't support Contains rather you can use in operator. To know more about that watch the below video I have explained how to use that:
https://www.youtube.com/watch?v=n3gOL32oy8s
Proud to be a Super User!
Regards,Hi @BeckyC
You could simply add another StartsWith() function separated with a ||.
Your formula could look like the following, while you'd need to replace <store ... field> with the corresponding field name:
SortByColumns(
Filter([@'Store Locations'],
StartsWith(<store name field>, SearchInputBox.Text) ||
StartsWith(<store number field>, SearchInputBox.Text)
) ,
"Store",
If(SortDescending1, Descending, Ascending)
)
As for contains, in Power Apps this is called in.
You can use this operator for example like so:
LookUp(<source>, city in cities).city
I hope this helps.
darn... just realized you were faster 😛
Thank to you both @KrishnaV and @FabianAckeret
The 2nd solution worked for me - I couldn't get the other one to work but that might have been my fault. I had my store cities locations as a text field and the store number was a number field. I thad changed the number field to text just now and then tried the 2nd solution and it worked.
I do still need to look into the IN part of the formula and play with that some more. But thanks to you both I have the searching worked out.
Becky
Here's the formula I ended up using so that you could find City as well as North City if you started typing the city name.
SortByColumns(
Filter([@'Store Locations'],
SearchInputBox.Text in Store ||
SearchInputBox.Text in Location
) ,
"Store",
If(SortDescending1, Descending, Ascending)
)
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
201 | |
177 | |
62 | |
32 | |
30 |
User | Count |
---|---|
317 | |
263 | |
104 | |
76 | |
56 |