Skip to main content

Notifications

Community site session details

Community site session details

Session Id : RrmTvcrswFJzAR3dqQJrXx
Power Apps - Building Power Apps
Unanswered

It is possible to use the Substitute function to replace a part of a string in all the rows of a sharepoint list

Like (0) ShareShare
ReportReport
Posted on 8 Apr 2022 14:54:13 by

How are you, I would like to know if this is possible, what happens is that I have a field in which initially the data is taken from a combobox to text, concatenating what the user chooses with commas, the field is more or less as follows

Text1,Text2,Nancy,Andres,Pedro,Carlos,Juan,Lucia

and so several rows with different texts

I would like to know if it is possible with the function for all () to go through all the elements of the list and update this part of the string with a new name, for example, where there is only Andres in all the rows of the list, update it for Camilo

Is this possible plus the patch + substitute function for example to update only that part of the string ?

Categories:
  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on 08 Apr 2022 at 17:48:53
    Re: It is possible to use the Substitute function to replace a part of a string in all the rows of a sharepoint list

    @Anonymous 

    Yes, but your statement implies using the ForAll incorrectly.  ForAll is a function that returns a table - it is not a for loop function.

     

    So, your ultimate formula would be similar to the following:

    Patch(yourDataSource,
     Filter(
     ForAll(yourDataSource,
     If("Andres" in yourColumnName,
     {ID: ID,
     yourColumnName: Substitute(yourColumnName, "Andres", "Camilo")
     }
     )
     ),
     !IsBlank(ID)
     )
    )
     

    In the above, the ForAll creates a table to pass to the filter (in order to remove blank records based on the If statement) which then returns the table of records to "fix" for patch.

     

    I hope this is helpful for you.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,651 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard
Loading started