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 / Substitute function
Power Apps
Answered

Substitute function

(0) ShareShare
ReportReport
Posted on by 21

I have a collection with 2 columns and i will like to compare values in my textinput control to column A of my collection and where macthed replace textinput.text value with value from column B of my collection

 

This is my code but it returns multiple lines of my text input and replaces them on a row bases. I will like to have just one text output with the acroymns replaced with their meaning - i.e. column 2 of my collection

 

ClearCollect(CollectParam,Acronyms);
ClearCollect(testA,Split(TextInput2.Text," "));
Clear(subTest);
ForAll(testA,ForAll(CollectParam,If(Value = Acronym,Collect(subTest,{Test:Substitute(TextInput2.Text,Value,Meaning)}))));

 

sample input and output

input

Aobiadazie2015_0-1684598894997.png

Output

Aobiadazie2015_1-1684599015255.png

i will like to have just one line of text  - "Good morning do you need Accounts and Markets and Accelerating Audit Execution today?"

Categories:
  • Verified answer
    Ash13 Profile Picture
    576 on at

    Hi @Aobiadazie2015 

    You can do this using a variable. On a button, or on the OnChange of the text input, try using this:

     

    Set(
     varSubbed,
     Concat(
     ForAll(
     Split(
     TextInput2.Text,
     " "
     ) As X,
     With(
     {
     _Ac: LookUp(
     CollectParam,
     Acronym = X.Value,
     Meaning
     )
     },
     If(
     IsBlank(_Ac),
     X.Value,
     _Ac
     )
     )
     ),
     Value,
     " "
     )
    )

     

     

    Then set the Default of the text input to the variable we just made:

     

    varSubbed

     


    (I've used CollectParam as your acronym collection, but since we don't need to do any collecting here, you might want to use your collection Acronyms instead, if I've read that correctly)

  • Aobiadazie2015 Profile Picture
    21 on at

    Wow thanks a lot @Ash13 !! works like i expected it too thanks so 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 139

Last 30 days Overall leaderboard