Hi 🙂
I have a gallery that uses the Office365Users.SearchUser() function, but I don't want the gallery to show all employees. I want the gallery to show only employees where ThisItem.City = "TEK".
How can I insert this condition for City into my Office365Users.SearchUser() function?
Solved! Go to Solution.
Use this mate, picking up on what @RandyHayes said:
Search(Office365Users.SearchUserV2({searchTerm:Trim(TextInput1.Text)}).value,TextInput2.Text, "City"))
On TextInput1 box you can search for a user's name, on TextInput2.Text you type TEK
This will give you the result you want. it will let you dynamically search for both user and city. Today you might want to search for TEK, but tomorrow you might need to search for something else.
@Anonymous
Please consider changing your Formula to the following:
Filter(Office365Users.SearchUserV2().value, city="TEK")
I hope this is helpful for you.
Do you want it hardcoded? Don't advise you to hardcode it. Add a second textinput box and then on the gallery put this:
Search(Office365Users.SearchUser({searchTerm: Trim(TextSearchBox1.Text), Top: 30}),TextInput2.Text,"City"))
This should do the trick
No, I'd not advise hard coding either. Good suggestion if it is needed.
However, SearchUser is deprecated, please start using V2 to avoid issues going forward.
Hi, @RandyHayes
I tried using this code, but it doesn't give me any data in the gallery.
However, if I use the function without any condition for City, the gallery brings me all the data.
Do you know what it can be?
Use this mate, picking up on what @RandyHayes said:
Search(Office365Users.SearchUserV2({searchTerm:Trim(TextInput1.Text)}).value,TextInput2.Text, "City"))
On TextInput1 box you can search for a user's name, on TextInput2.Text you type TEK
This will give you the result you want. it will let you dynamically search for both user and city. Today you might want to search for TEK, but tomorrow you might need to search for something else.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
190 | |
69 | |
50 | |
38 | |
28 |
User | Count |
---|---|
243 | |
112 | |
91 | |
91 | |
71 |