cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
FredG
Level: Powered On

Searching on a people/person field

We have an app for requests management. The requests go through 4 phases and each phase has an "assigned to" person/people field. Business user wants to be able to include these 4 person/people field in our Search. 

 

Coded the search on the gallery's item property. However, I am getting an error on the people/person field saying "The function 'Search' has some invalid arguments. Wrong column type. Expect text type". Obviously the person/field is not seen as text.

 

Anybody have a workaround for this? 

 

Thanks.

 

btw. Business users also want to include Date fields on the search and getting the same error in including them on the 'Search' code.

1 ACCEPTED SOLUTION

Accepted Solutions
Beat
Level 8

Re: Searching on a people/person field

Maybe you've figured out a workaround in the meantime, if not, here's a way to do it.

Create an additional column in your SharePoint list of type single line of text.

If your person column is "AssignedTo", name the new column "AssignedToString" or the like.

Create a Flow triggered by "When an item is created"

Action "Update Item"

Populate AssignedToString field with AssignedTo.DisplayName

Now you have a text field containing the AssignedTo person's name and can thus include it in the Search function

Search(DataSource,TextSearchBox1.Text,"AssignedToString")

I've done this for multiple person fields in a list, e.g. AssignedToString, ProjectManagerString, ApproverString with the result that a user can search for a fraction of his name and will see all records where he figures in any of these roles.

I've as well used it for the ID of a record. so that in the same search box you can enter the ID and find any matches. Not very elegant because searching for 12 will not only return 12 but any ID containing the string "12" (123, 312, 3125, whatever).

I think date fields can be dealt with in the same way, but an exact date will have to be entered as search term, as otherwise the results will be quite ambiguous (03/20 for example could return 03/20/2018 but as well 05/03/2018.

Please let me know if this helps.

 

View solution in original post

4 REPLIES 4
Super User
Super User

Re: Searching on a people/person field

What is the formula you are using in the Items property of Gallery to do the search?



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Power Apps Staff Kala
Power Apps Staff

Re: Searching on a people/person field

Hi FredG,

 

Search Function supports only string searches. Have you used Filter / Lookup functions? They take other fields that are not string.

 

You can findthe examples and usage here: https://docs.microsoft.com/en-us/powerapps/functions/function-filter-lookup

 

Let me know if this helps.

 

Thanks

Kala Anantharaman

 

Beat
Level 8

Re: Searching on a people/person field

Maybe you've figured out a workaround in the meantime, if not, here's a way to do it.

Create an additional column in your SharePoint list of type single line of text.

If your person column is "AssignedTo", name the new column "AssignedToString" or the like.

Create a Flow triggered by "When an item is created"

Action "Update Item"

Populate AssignedToString field with AssignedTo.DisplayName

Now you have a text field containing the AssignedTo person's name and can thus include it in the Search function

Search(DataSource,TextSearchBox1.Text,"AssignedToString")

I've done this for multiple person fields in a list, e.g. AssignedToString, ProjectManagerString, ApproverString with the result that a user can search for a fraction of his name and will see all records where he figures in any of these roles.

I've as well used it for the ID of a record. so that in the same search box you can enter the ID and find any matches. Not very elegant because searching for 12 will not only return 12 but any ID containing the string "12" (123, 312, 3125, whatever).

I think date fields can be dealt with in the same way, but an exact date will have to be entered as search term, as otherwise the results will be quite ambiguous (03/20 for example could return 03/20/2018 but as well 05/03/2018.

Please let me know if this helps.

 

View solution in original post

Beat
Level 8

Re: Searching on a people/person field

SortByColumns(
    Search(
        Filter(
            'Itemlist',
            Prod.Value = If(tglTestProd.Value, "Production", "Test")
        ),
        TextSearchBox1.Text,
        "Title",
        "idSearchString",
        "reqSearchString",
        "coordSearchString",
        "emplSearchString",
        "statusSearchString"
    ),
    "ID",
    If(
        SortDescending1,
        Descending,
        Ascending
    )
)

Where the ...SearchString columns are the ones with the string values populated by the workflow.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,482)