cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kharina
Helper V
Helper V

Combine formula for default value and searchable option

Dear PowerApps Team, 

 

Can you please help me to combine a formula:

 

I use: Choices([@People1].AllUsers) in a dropdown - to display all office365 users, 
Then I also used: Office365Users.Manager(User().Email).Mail - to display the User's ManagerName. 


 

Is it possible for me to combine the 2 formulae in a dropdown  -  so that I can display the Email Address of the User's Manager but if the user has no Manager, the message will show "No Manager, please select". 

 

Thank You ,

Kharina

5 REPLIES 5
Anonymous
Not applicable

Hi @kharina ,

 

Yes, it can be done.

 

For property of "Items", you can modify the formula to:

Concatenate(Office365Users.UserName,"-",If(IsBlank(Office365Users.Manager(User().Email).Mail),"No Manager, please select",Office365Users.Manager(User().Email).Mail))

 

Then in the property of "Update" of the Item DataCard, you can change your formula to:

Left(YourDataCardValue.Selected,Find("-",YourDataCardValue.Selected-1))

 

In this way, the data in your data source will only save the user's name, but you can view both username and his manager's email address in the dropdown.

 

You may need to add "Value"/"Result"... if the formula returns any errors.

 

Hope this can help.

 

Best regards

Anonymous
Not applicable

Hi @kharina ,

 

Forgot another formula, please change the property of "Default" to following:

Concatenate(Parent.Default,"-",Office365Users.Manager(User().Email).Mail)

 

Sorry for missing this.

 

Best regards

Hi @Anonymous ,

I appreciate your  reply.

I am getting this error:   "The function 'Concatenate' has some invalid arguments".

kharina_1-1605596709232.png

 

 

Also, the 2nd Concatenate shows"

Office365Users.UserName

-this one won't work on my app. I use: O"ffice365Users.MyProfile().DisplayName" .

Is there another way to do a combination of  fomulae?

 

v-jefferni
Community Support
Community Support

Hi @kharina ,

 

Could you please share more details about you scenario? Which data source are you working with? Do you want to show user name with its manager's email address if exist, if not, with the those words "No Manager, please select"?

 

If you do want to achieve the goal that I presumed above, you could try to use a collection in the dropdown's items property, below are formulas that create the collection and you could put them on the OnVisible of the Screen:

 

ClearCollect(colUsers,Office365Users.SearchUserV2({top:999}).value);

Clear(colUsers2);Clear(colUsers3);ForAll(colUsers,Collect(colUsers2,{Name:ThisRecord.DisplayName,Mail:ThisRecord.Mail,UPN:ThisRecord.UserPrincipalName}));         
// you could add any other fields into the collection in this line.

Collect(colUsers3,AddColumns(colUsers2,"UserManager",Concatenate(Text(ThisRecord.Mail)," - ",If(IsBlank(Office365Users.ManagerV2(ThisRecord.UPN)),"No Manager, please select",Text(Office365Users.ManagerV2(ThisRecord.UPN).mail)))))

 

With collection "colUsers3" in the Items of the dropdown box, you could select the UserManger field to display the Email of manager or the words.

4.png

5.png

 

While the items in the dropdown is Not an item of User Profile, if you would like the selected user be updated to the data source, you could modify the Update of the data card which holds the dropdown to:

LookUp(Choices([@People1].AllUsers)], UserPrincipleName = Dropdown.selected.UPN)

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Hello @v-jefferni , 

 

Thank you for your explanation. I am trying what you provided me. 

But I want to show you this to answer your question on top:

 

kharina_0-1605603012480.png

 

So I have here a DataCard - that is connected to a sharepoint list. I can search all the users with the formula: 

"Choices([@People1].AllUsers)"

 

I also have a Label1 - that shows my name as a user

 

And I also have Label 2 - to show my manager's email address. I used: 
"Office365Users.Manager(User().Email).Mail"

"What I want to achieve = a dropdown that has a default value (which is Label2), but if the Manager field in Azure is empty, it will show the message : 'No Manager' and gives an option to select just like in my DataCardValue2"

I want to know if it is possible to combine.

 

Thank you so much,

Kharina

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,191)