How to add Null+Value

Neetu Verma April 1, 2020

I have 3 custom field which stores the estimation for 3 work categories.  They all are numeric fields.

Our Story point is the addition of all these 3 fields

 

I have this Math rule which works if 3 of these are valued

{{#=}} {{issue.customfield_12018}} + {{issue.customfield_12020}} + {{issue.customfield_12102}} {{/}}

But sometime not all 3 fields will be valued and then I get below error


Error rendering smart-values when executing this rule:Missing parameter(s) for operator +: + 0.25 +

Can someone help me to figure out how to handle Null

1 answer

1 accepted

14 votes
Answer accepted
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 6, 2020

Hi Neetu - try this code which sets the value of the field to 0 first if it is missing a value:

{{#=}} {{issue.customfield_12018|0}} + {{issue.customfield_12020|0}} + {{issue.customfield_12102|0}} {{/}}

Neetu Verma April 6, 2020

OMG.. John

Thank you so much.. it worked. I cant even thank you enough for making this work. I am super glad I didn't put a workaround. 

 

Thanks

Neetu

Like rcampos likes this
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 6, 2020

Great! I am glad that worked for you.  :-)

Can you click on the Accept answer button above so we can close this one out? Thanks!

Mustafa Slatewalla May 28, 2021

Awesome !! This worked Well !!

Like John Funk likes this
Jeshua Paul
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 10, 2024

This is exactly what I needed as well, thank you @John Funk !!! The "|0" is brilliant and will be really useful for number fields in the future !

Like John Funk likes this
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 10, 2024

Great! Glad you found it useful. 

Suggest an answer

Log in or Sign up to answer