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'

View solution in original post

3 REPLIES 3
Highlighted
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

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'

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 93 members 4,898 guests
Please welcome our newest community members: