Skip to main content

Notifications

Power Automate - General Discussion
Answered

Replace null with a value

(1) ShareShare
ReportReport
Posted on by 505

Using a Compose action, how can I when a null value is presented provide some generic value. So if x=null enter 1. I have an array variable going to an initialize variable using the array type and it is failing because of the null value.

  • Suggested answer
    MP-08080224-0 Profile Picture
    MP-08080224-0 2 on at
    Replace null with a value
    The coalesce function returns the first non-null value.  So, you can do this:
    coalesce(<the value that might be null>,<the value you want to replace nulls>)
    or, using the values supplied in the original post:
    coalesce(x,1)
     
  • Tryin2Flow Profile Picture
    Tryin2Flow 7 on at
    Re: Replace null with a value

    This worked great for my flow.  Needed to create a "0" value when null and the entered value when not null. In compose > expression 

    Tryin2Flow_1-1658868257304.png

     

  • Verified answer
    manuelstgomes Profile Picture
    manuelstgomes 6,625 on at
    Re: Replace null with a value

    Hi @send2mark 

     

    Here's the formula:

    if(equals(<VALUE TO TEST>,null),'Value if null','value if not null')

     

    You can check if the value is null or not. If it's not null you can put in the formula the same value otherwise your default value.

     

    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

    Cheers
    Manuel

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,691

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 65,019

Leaderboard