# Empty values breaking simple math

I need some advice on what I feel like very basic problem. I am displaying numbers which are simple sums of different inputs. However, it seems when an input is empty it break the formula and nothing is displayed.
So the question is how do I make expressions be 0 and not empty?
Alternatively, how do I ignore empty values when summing things? (not a list or a group, just input fields). An example would be a text field displaying from a Math.Js calculation, that is a sum of other Math.JS calculations

Hello @dsaiko welcome to the forum!

One way to deal with this is to monitor whether the input’s value is empty or not. If not … then assign it a value of zero.

Build it into your logic everywhere needed.

How would I do that if I am adding let’s say 3 numbers A+B+C, and any one of the three may be empty? In conditional, I can do A Result (Number) is empty, and set expression to 0
But that would set summation of B+C to 0. Can I set input conditional too? But that would be on the output of each object then.
And on output, I can do if empty set expression to zero, Math.JS that gives me recursion error. So bit back to square one.
I am not even doing hard math, just need brackets

There is an experimental feature that allows you to use brackets. Also you should search the forums for “format as text” which can give you conditional formatting if needed to replace empty with 0.

Thanks for the parentheses tip, turned it on!

In regards to the empty situation. I found some as you mentioned but very indirect ones around format as text. I think most is on display objects such text and graphs, and I need it on output. As I am trying to chain outputs. So the A+B+C = D does not break going into D, so that D + E works, type thing.
Basic output conditions give me the following problem, the expression is 0 in conditions but is still empty. Which makes no sense to me, but it is what it is. Some sort of type override?

Then if I try format as text, i write something like this. Where YES is 0, and NO is This Math.JS result (Number). But it feels like I using this totally incorrectly.

try text - find and replace then, (find empty) replace with 0

This topic was automatically closed after 70 days. New replies are no longer allowed.