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

How to convert display name to string

Hi, 

I'm currently designing an app for a business case. One of the requirements is that it has to save employee names, even after they left the organisation and their account is purged from the Active Directory. The app works on a SharePoint List.

 

I think I can manage this by adding two Data value fields in my app (see picture): 
1st field: person/group selector
2nd field: single line of text

Where the 2nd field retains the string of the DisplayName indefinitely, even when the user profile is deleted from AD. 

 

app.jpg

What I want to achieve is extracting the Display Name out of the selected item in the 1st field, and copying it, as a string, into the 2nd field. 

I have been able to solve this issue with single values before, but right now I either get the 'expects text, but instead it receives a table'-error, or I managed to copy the Display Name onto the 2nd field, but it didn't work in the user experience as I can't figure out how to run the copy-function after selecting the employee. This causes the function to run at loading of the screen, not after selecting the employee in the 1st column. 

Has anyone encountered this, or knows how to delay the function running until I have selected an employee? 

1 ACCEPTED SOLUTION

Accepted Solutions
Thijsvan1010
Level: Powered On

Re: How to convert display name to string

Fixed it. 

The Powerapp studio autofills, which caused me to continue to continue along the wrong path. 

The right answer is: 

You select the #2 input field's DataCard, in the righthand panel you see the slot called 'update'. In there you type:
EmployeeValueX.Selected.DisplayName (where EmployeeValueX points to the name of the People Picker field's DataCardValue, not the DataCard itself).


The autofill of Powerapp constantly said I should type 'SelectedItems', causing it to load the entire table, instead of the single value. This in turn caused me to try and extract from the table, which could easily be done by typing 'Selected.DisplayName'

3 REPLIES 3
KC
Level 8

Re: How to convert display name to string

You should be able to set the Text property of your Name Employee field like this:

 ddEmployee.Selected.Value

Highlighted
Thijsvan1010
Level: Powered On

Re: How to convert display name to string

Yeah, 

one of the methods I tried was adding an OnSelect-function in the 1st field, which sets a global variable, which is then loaded as a Default-function into the 2nd field. 

This works when I want to edit an entry. It doesn't work when I create one, since the Default-function runs as soon as the page is loaded, at which time the global variable is still an empty variable. So I need to find a delay for that Default-function to run after I selected the item in the 1st field.

Thijsvan1010
Level: Powered On

Re: How to convert display name to string

Fixed it. 

The Powerapp studio autofills, which caused me to continue to continue along the wrong path. 

The right answer is: 

You select the #2 input field's DataCard, in the righthand panel you see the slot called 'update'. In there you type:
EmployeeValueX.Selected.DisplayName (where EmployeeValueX points to the name of the People Picker field's DataCardValue, not the DataCard itself).


The autofill of Powerapp constantly said I should type 'SelectedItems', causing it to load the entire table, instead of the single value. This in turn caused me to try and extract from the table, which could easily be done by typing 'Selected.DisplayName'

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 386 members 5,828 guests
Please welcome our newest community members: