Skip to main content

Notifications

Community site session details

Community site session details

Session Id : HsAWl4Hnm/72V5WYp/sb37
Power Automate - Building Flows
Answered

Getting Null/Empty Values to Produce a Value of 0 so the flow Doesn't Fail

Like (0) ShareShare
ReportReport
Posted on 27 Jun 2023 14:56:15 by 78

Hello, I need some help. I currently have flow that when an item is created or modified from the Project Budget Hours List it is than converted into the Jobs Budget Hours List. The issue I am having is any time a user leaves a field blank in the form/list the flow will fail because of a null value. The low works perfectly if all the field are filled but not every time will every field be filled. I was wondering if somebody can help me with producing a value of 0 when a field is empty/null. My flow is Located below:

diegothompson12_0-1687877519393.pngdiegothompson12_1-1687877546219.png

diegothompson12_3-1687877623373.png

 

I would appreciate any help thanks!

  • diegothompson12 Profile Picture
    78 on 28 Jun 2023 at 11:59:49
    Re: Getting Null/Empty Values to Produce a Value of 0 so the flow Doesn't Fail

    @wskinnermctc  Thanks this works perfectly. This helped me understand a lot more about this application. 

  • Verified answer
    wskinnermctc Profile Picture
    6,517 Super User 2025 Season 1 on 27 Jun 2023 at 20:03:20
    Re: Getting Null/Empty Values to Produce a Value of 0 so the flow Doesn't Fail

    Ok got it, this should work all of the time.

     

    We are using the coalesce() expression which gets the first non-null value from a line of items. So coalesce("Dan","Steve","Mark") would return "Dan". If you have coalesce(null,"Steve","Mark"), then it would return "Steve" since it skips over the first null item.

    I am also wrapping a zero 0 in the int() integer expression just to be sure it returns a number. 

     

     

    coalesce(triggerOutputs()?['body/Design_DSG'],int(0))

     

     

    Here is a screenshot of the expression

    Coalesce ExpressionCoalesce Expression

     

    This is basically saying if your value is null then return a zero 0 as an integer which just means number.

     

    Let me know how this works,

  • diegothompson12 Profile Picture
    78 on 27 Jun 2023 at 19:26:06
    Re: Getting Null/Empty Values to Produce a Value of 0 so the flow Doesn't Fail

    Hi @wskinnermctc 

     

    Here is the error message I am getting:

    diegothompson12_1-1687893821247.png

    The formula I used: 

    if(empty(triggerOutputs()?['body/Design_DSG']),0,triggerOutputs()?['body/Design_DSG'])
    The coulmn I am Trying to use:
    diegothompson12_2-1687893945186.png

     

     

  • wskinnermctc Profile Picture
    6,517 Super User 2025 Season 1 on 27 Jun 2023 at 18:07:17
    Re: Getting Null/Empty Values to Produce a Value of 0 so the flow Doesn't Fail

    I think it has to do with the sharepoint column name for your list Project Hours Budget and the column that has the display name "Design_DSG HRS" in your screenshot.

     

    Can you go to the column settings in your list and check the internal name of the column? You can see it up in the address bar.

    SharePoint Column Internal NameSharePoint Column Internal Name

     

    You can also check the value in the flow by hovering over the dynamic content.

    SharePoint Column Name Dynamic ContentSharePoint Column Name Dynamic Content

     

    So for my example column the expression would be:

    if(empty(triggerOutputs()?['body/Design_DSGHRS']),0,triggerOutputs()?['body/Design_DSGHRS'])

     

    Even though the display name is "Design_DSG HRS" the internal name is "Design_DSGHRS" so the internal name needs to be used in expressions.

  • diegothompson12 Profile Picture
    78 on 27 Jun 2023 at 17:31:05
    Re: Getting Null/Empty Values to Produce a Value of 0 so the flow Doesn't Fail

    Hey @wskinnermctc 

     

    That is correct. I want the field to be 0 if it is left blank but it is still making it zero even if there is a number in that field. 

     

    Put the expression under the design DSG field to test it out:

    Formula: 

    if(empty(triggerOutputs()?['body/Design_DSG_HRS']),0,triggerOutputs()?['body/Design_DSG_HRS'])

    diegothompson12_1-1687886843225.png

    Project Budget Hours: 

    diegothompson12_2-1687886974820.png

    What is created on the Jobs Budget Hours List:

    diegothompson12_3-1687887041985.png

    I could be doing something wrong.

     

     

  • wskinnermctc Profile Picture
    6,517 Super User 2025 Season 1 on 27 Jun 2023 at 15:53:28
    Re: Getting Null/Empty Values to Produce a Value of 0 so the flow Doesn't Fail

    You said you wanted it to show a zero 0 if they left the field blank.

     

    Did you want a different output?

  • diegothompson12 Profile Picture
    78 on 27 Jun 2023 at 15:37:13
    Re: Getting Null/Empty Values to Produce a Value of 0 so the flow Doesn't Fail

    Hello @wskinnermctc,

     

    Thanks for the help. It kinda of works but puts in a zero no matter if there is a vale or not!

  • wskinnermctc Profile Picture
    6,517 Super User 2025 Season 1 on 27 Jun 2023 at 15:07:10
    Re: Getting Null/Empty Values to Produce a Value of 0 so the flow Doesn't Fail

    Use the expression if() combined with empty() to check the value.

     

    It will be something like if(empty([value]),0,[value]) so this expression says If the [value] is empty, then return zero 0, if not then return [value].

     

    A better example for the create item might be something like:

    if(empty(triggerOutputs()?['body/AdminDSG']),0,triggerOutputs()?['body/AdminDSG'])

     

    Just use your values in the expression. Let me know if this works 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!

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community

Announcing Our 2025 Season 1 Super Users!

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

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,513 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,636 Most Valuable Professional

Leaderboard
Loading started