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:
I would appreciate any help thanks!
@wskinnermctc Thanks this works perfectly. This helped me understand a lot more about this application.
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 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,
Here is the error message I am getting:
The formula I used:
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 Name
You can also check the value in the flow by hovering over the dynamic content.
SharePoint 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.
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:
Project Budget Hours:
What is created on the Jobs Budget Hours List:
I could be doing something wrong.
You said you wanted it to show a zero 0 if they left the field blank.
Did you want a different output?
Hello @wskinnermctc,
Thanks for the help. It kinda of works but puts in a zero no matter if there is a vale or not!
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,
WarrenBelz
146,513
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,636
Most Valuable Professional