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
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

New Process Advisor Capabilities carousel.png

Read the blog for the latest news

Read the latest about new experiences and capabilities in the Power Automate product blog.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (1,781)