cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

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
Highlighted
Regular Visitor

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'

View solution in original post

3 REPLIES 3
Highlighted
Continued Contributor
Continued Contributor

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
Regular Visitor

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.

Highlighted
Regular Visitor

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'

View solution in original post

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,888)