web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Having trouble substit...
Power Apps
Answered

Having trouble substituting/replacing text in a populated field.

(0) ShareShare
ReportReport
Posted on by 28

I'm building a form for Users to populate others to populate and then update a text box and the Users will then copy that text and input into a. The Populate Text button activates a flow that grabs file context from a Txt file and inserts it into a text box with var"" parameters. We then want the Users to fill out the form and click the Update Text button so that the var"" get substituted/replaced with the given values in the form. What's working is populating the text box with the file contents. What's not working is the substitution. I could use some help please. See screenshots below.

Screenshot 3.jpg
Screenshot 2.jpg
Screenshot 1.jpg
Categories:
I have the same question (0)
  • BCBuizer Profile Picture
    22,654 Super User 2026 Season 1 on at

    Hi @MrGrant ,

     

    The issue is that the Substitue functions are not nested in the Set function, meaning that the changes they are making are not saved in the variable.

     

    If you need any help with that, please post your formula as text instead of a screenshot.

  • MrGrant Profile Picture
    28 on at

    Sorry about that, here are the functions I have for the PowerApp so far.

    Text Box: 
    varResultsTemp

    Populate Text Button:

    Set(varResultsTemp,'CCAConstants-GetConstants'.Run().constantstext)

    Update Text:
    Set(varResultsTemp,varResults);
    Substitute(varResults,"<varProjectEmail>",ProjectEmail.Text);
    Substitute(varResultsTemp,"<varProjectName>",ProjectName.Text);
    UpdateContext({varResults:varResultsTemp})

  • BCBuizer Profile Picture
    22,654 Super User 2026 Season 1 on at

    Hi @MrGrant ,

     

    This should do the trick:

    Set(
    	varResultsTemp, 
    	Substitute(
    		Substitute(
    			varResults,
    			"<varProjectEmail>",
    			ProjectEmail.Text
    		),
    		"<varProjectName>",
    		ProjectName.Text
    	)
    );
    
    UpdateContext({varResults:varResultsTemp})
  • MrGrant Profile Picture
    28 on at

    BCBruizer, thanks for responding again. So, I input your suggested context into my button and it has a red x. The sequence is, I push the Populate button to grab file contents from sharepoint and import into the text box field. Then I want to substitute/replace what Users fill in with the surrounding text inputs after I press the Stephen Test Update button. Nothing is happening when I push that button. The formality of the code you provided seems good. What's missing?

    Screenshot 10-6-23.png
  • BCBuizer Profile Picture
    22,654 Super User 2026 Season 1 on at

    Hi @MrGrant ,

     

    When I look at the formula in your screenshot, it seems different from what I posted. Can you please try to literally copy-paste my formula to the OnSelect property of the button?

  • MrGrant Profile Picture
    28 on at

    I did copy it again and when I push the button it clears the populate text box instead of updating the input contents. I would like the text box to just update with the fields from the form. Is this possible?

  • Verified answer
    BCBuizer Profile Picture
    22,654 Super User 2026 Season 1 on at

    Hi @MrGrant ,

     

    I think the issue is that you started using two variables, but then switched to a single one. Eliminating varResults from the formula altogether shoud do the trick:

     

    Set(
    	varResultsTemp, 
    	Substitute(
    		Substitute(
    			varResultsTemp,
    			"<varProjectEmail>",
    			ProjectEmail.Text
    		),
    		"<varProjectName>",
    		ProjectName.Text
    	)
    );
  • MrGrant Profile Picture
    28 on at

    Yes Sir, that worked! Thank you very much!!!!!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard