cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
venseben
Helper V
Helper V

Coalese and replace in flow

Hi all. I have a bit of trouble with updating a string in SharePoint list items if the field is blank. I have tried to do a combination af Coalese and Replace, but it fails for me everytime. All I want is to avoid the "null errors" whenthe flow runs. The flow is at this time pretty simple:

 

A select component to pick the columns I need to make changes to:

Error01.jpg

A for each control, where I want to make the magic:

Error02.jpg

 

I have tried several things, for example:

Coalese(item()?['Column3'],'',replace(item()?['Column3'],'Old text','New text'))
if(coalesce(item()?['Column3'],'',replace(item()?['Column3'],'Old text','New text')))

Can anyone guide me in a correct direction, so I can make the changes to the list items without getting the "null error" when the field is blank. All I want is that if the field is not blank, then I need to replace a string, but I keep running into these "Null errors".

 

Thanks in advance

/Frank

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @venseben 

 

Try the following

 

if(equals(length(item()?['Column3']), 0), 'New Text', 'Old Text')

 

Thanks

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

View solution in original post

4 REPLIES 4
abm
Super User
Super User

Hi @venseben 

 

Try the below expression

Coalese(item()?['Column3'],'New text'))

 

You can use the coalesce function to provide default values when a value is null. So in your case if the value is null then it will replace with 'New Text'.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Hi @abm and thx for quick reply. All I want is to avoid the blank fields, so if a field is blank, the flow should just ignore it, and continue til a field that has data. I cannot get your solution to do this 😐

 

/Frank

Hi @venseben 

 

Try the following

 

if(equals(length(item()?['Column3']), 0), 'New Text', 'Old Text')

 

Thanks

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Thx @abm It was not directly what I wanted but it led me in the right direction 🙏

 

Frank

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate 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 Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (5,152)