cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Aurora
Helper IV
Helper IV

Creating a text input to search a sorted gallery

Hi all, 

 

I have a gallery in an app that shows users all the other apps they have access to. All I need to do is add an input to make the app list searchable, so end users can find what they need faster. I'll include my Items property for the gallery, as well as the code I've been trying to use: 

 

Gallery: 

Sort(
Filter(AppCollection, Not StartsWith(properties.displayName, "(Testing)") && properties.displayName <> "AUNA MAIN"),
properties.displayName
)
 
Code for search: 
Search(AppCollection, TextInput2.Text, "name")
 
I have been trying to use a Concurrent function, but I'm unsure if that's the best way to do things and have yet to make it work. 
 
I appreciate any help!
1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Aurora ,

Try this

Filter(
   AddColumns(
      AppCollection, 
      "DisName",
      properties.displayName
   ),
   !(
      StartsWith(
         DisName,
         "(Testing)"
      ) 
   ) && 
   DisName <> "AUNA MAIN"
).DisName

 

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.

View solution in original post

8 REPLIES 8
landonjochim
Resolver I
Resolver I

This is your Gallery's item property:

Search(Filter(AppCollectionNot StartsWith(properties.displayName, "(Testing)"&& properties.displayName <> "AUNA MAIN"),
properties.displayName
), TextInput2.Text, "name")
 
The last argument of "name" is the column you want to search by in the gallery.
 
Landon

@landonjochim 

 

When I try this, I get an error stating It is expecting 3 arguments, but receiving 2. I'm not entirely sure what to put in "Name" either. Would it be the source that all of the apps are being generated from? 

Looks like you are only going to be returning the displayName in the gallery. Replace columnName with the column you want to be filtering by and returning. 

 
Search(Filter(collection,!StartsWith(columnName,"(Testing)"),columnName<>"AUNA MAIN").columnName,TextInput2.Text,"columnName")
Aurora
Helper IV
Helper IV

@landonjochim 

 

The following formula doesn't give me any errors: 

Search(Sort(Filter(AppCollection, Not StartsWith(properties.displayName, "(Testing)") && properties.displayName <> "AUNA MAIN"),
properties.displayName
), TextInput2.Text, "name")

 

However doesn't sort the way I want it to yet. I did not build this app, the person who did no longer works with us. I'm not entirely sure where the list or gallery is even being pulled from, but all I need now is for apps to appear on the screen based on the text input. 

 

The datasource is a collection, but I know almost nothing about it. I know I need to change "name", but I don't know to what. 

 

Aurora_0-1633970216803.png

^Datasource

Search(Sort(Filter(AppCollection,!StartsWith(displayName,"(Testing)") && displayName<>"AUNA MAIN"),displayName),TextInput2.Text,"displayName")

 

If you collection has a column of "displayName" and that is what you are doing your filtering on, you can remove the "properties.". If you want to search based on the displayName, then you need to change "name" to displayName. By default it is going to sort by the defined column Ascending. To change this you would need to add a comma and add Ascending or Descending

 

Search(Sort(Filter(AppCollection,!StartsWith(displayName,"(Testing)") && displayName<>"AUNA MAIN"),displayName, Descending),TextInput2.Text,"displayName")

Aurora
Helper IV
Helper IV

 
Still not working for me, It's saying "displayName" doesn't exist, but I do see a column for it. 
Aurora_0-1633971650008.png
Aurora_1-1633971680318.pngAurora_2-1633971737156.png

 

displayName appears in the 3rd image.

 

Any ideas?

Aurora
Helper IV
Helper IV

@landonjochim 

 

It looks like displayName might not be a column itself, but could be a property of the collection? I can sort by App Id # right now, the only real issue is that no one will know the Id so this isn't practical. 

WarrenBelz
Super User
Super User

Hi @Aurora ,

Try this

Filter(
   AddColumns(
      AppCollection, 
      "DisName",
      properties.displayName
   ),
   !(
      StartsWith(
         DisName,
         "(Testing)"
      ) 
   ) && 
   DisName <> "AUNA MAIN"
).DisName

 

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.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,021)