cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Search for City or Number

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

1 ACCEPTED SOLUTION

Accepted Solutions
Solution Specialist
Solution Specialist

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.

 

Please click Accept as Solution if my post answered your question. Like my answer? Consider giving it a Thumbs Up. Others seeking the same answers will be happy you did.

View solution in original post

5 REPLIES 5
Super User III
Super User III

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

 


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.
Solution Specialist
Solution Specialist

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.

 

Please click Accept as Solution if my post answered your question. Like my answer? Consider giving it a Thumbs Up. Others seeking the same answers will be happy you did.

View solution in original post

@KrishnaV 

 

darn... just realized you were faster 😛

Please click Accept as Solution if my post answered your question. Like my answer? Consider giving it a Thumbs Up. Others seeking the same answers will be happy you did.
Frequent Visitor

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

Frequent Visitor

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)
)

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (7,216)