cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
greddin
Helper II
Helper II

String Substitution / Replacement Help

I have the following form.  Currently, as the First Name and Last Name fields are entered, the text is concatenated together to populate the Display Name field.  

 

To do this I'm using:  (where DataCardValue2 = First Name & DataCardValue3 = Last name) on the Default value of the Display Name text field.

 

Concatenate(DataCardValue2.Text," ",DataCardValue3.Text)

 

 

Now, I need to substitute/replace the Display Name's First Name with the name entered into the Nick Name field (if it isn't blank).

 

I was trying to use this on the Nick Name (DataCardValue4) OnChange property but it doesn't work.

 

Substitute(DataCardValue1.Text,DataCardValue2.Text,DataCardValue4.Text,1)

 

 

In this example I would want the Display Name to say "Johnny Doe" now instead of "John Doe".  If Nick Name exists it only needs to update the first name of the Display Name text.  Does this make sense? 

 

form2.png

Thank you for some help.

-Greg

1 ACCEPTED SOLUTION

Accepted Solutions
TheRobRush
Super User
Super User

Lets say I have 3 text inputs

First
Last

Nick

In my label i place

Switch(
       IsBlank(Nick.Text),
       true,
       Concatenate(First.Text," ",Last.Text),
       Concatenate(Nick.Text," ",Last.Text))
_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

View solution in original post

2 REPLIES 2
TheRobRush
Super User
Super User

Lets say I have 3 text inputs

First
Last

Nick

In my label i place

Switch(
       IsBlank(Nick.Text),
       true,
       Concatenate(First.Text," ",Last.Text),
       Concatenate(Nick.Text," ",Last.Text))
_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

Thank you Rob!  Why didn't I think of that?  Really appreciate your help again 🙂 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

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.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,632)