Hello all,


For an application with lots of calculations I have a problem with the null values of decimals. When an input (Number) field is empty, i don't need the calculations to be run. But, OutSystems converts empty Decimals into 0. But, the number 0 should be a legit value. 


How to overcome this "bug" in OutSystems?

Hi Martin,

Is there any value that is invalid?... you can use the Null Value attribute of an input to specify what should the empty input value be.  

You can use the TypedValue runtime property of the input and check whether it's empty.

There are no invalid values. And I forgot to tell you, but it is a mobile application. The Typed Value Praperty isn't implemented there.

Ok, so there's always the possibility to bind the input to a Text variable. In that case, you will need to perform validation yourself.

Another possibility is to fetch the input value in a Javascript block. Create a Javascript block with InputWidgetId as input, and TypedValue as output. Then write something like:

$parameters.TypedValue = document.getElementById($parameters.InputWidgetId).value;

Martin Rozeboom wrote:

Hello all,


For an application with lots of calculations I have a problem with the null values of decimals. When an input (Number) field is empty, i don't need the calculations to be run. But, OutSystems converts empty Decimals into 0. But, the number 0 should be a legit value. 


How to overcome this "bug" in OutSystems?

Hi Martin,


did you find a satisfactory solution for your problem? I also am disapointed that I cannot store empty values. There is no way to tell whether someone deliberately stored 0 or didn't input anything yet.


My understanding of another workaround is to store the decimal as text which accepts an empty cell represented by "". Then use the TextToDecimal() function to convert to a number if calculations are required. I have the same problem that a default to zero has very different implications from an empty cell - particularly since I use the data in a machine learning programme so zero and no data have different connotations. I have not tried the TextToDecimal function yet but I wonder if it converts a null text cell to zero. In which case I end up at the same problem with not being to tell the difference between zero and true null?

Hi Tommy, yes TextToDecimal function would convert an empty string to decimal 0. However, you could check if you got an empty string with the If function, or you could use TextToDecimalValidate which would return false for an empty string.


For those still coming to this thread, there are multiple workarounds described above, and summarized below. If you feel that none of these workardounds are valid for your scenario, then please state your scenario clearly so we can help you. If you find a workaround that solves your problem, then I see no point in continuing posting to this thread.

The lack of distinction between nulls and 0 is a feature in OutSystems, not a bug. If you want to influence this decision, feel free to like this idea: https://www.outsystems.com/ideas/213/null-values

Workaround 1: use a text variable, then use TextToDecimalValidate/TextToDecimal to safely convert the value into a decimal before using in business logic.

Workaround 2: use TypedValue runtime property of the input widget, which is available in web applications.

Workaround 3: in a mobile application, use "document.getElementById($parameters.InputWidgetId).value" inside a JavaScript node to retrieve the typed value as text.