cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FredG
Advocate I
Advocate I

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
Helper V
Helper V

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
Jeff_Thorpe
Super User
Super User

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.
Kala
Power Apps
Power Apps

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
Helper V
Helper V

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

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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,353)