Null to Zero - can't seem to ge this to work.

Null to Zero - can't seem to ge this to work.

I am having difficulty converting null to zero. I posted this question yesterday and was given a response but I cannot get it to work.

In a nutshell I have a formula field (InsertCost) that contains 2 fetched fields (decimal) that I need to divide.I have set the input.pubcost and input.allocation default values to 0. But my formula keeps coming up with NULL. 

(input.pubcost/input.allocation)

If the fetched fields contain data there is no problem but these fields often they will have no value and I need to generate reports with equations.

I tried this fix:

Use ifnull to replace Null to 0.

<variable> = IFNULL( <expression1>, <expression2>)

example :   strA = ifnull(input.pubcost,"0");
                 strB = ifnull(input.allocation,"0");
                 Result= strA/strB;

** is any datatype error convert it to decimal.










 I could not get it to work. I get data type errors and the toDecimal will not work either. I am at a loss and appreciate all shared wisdom and suggestions!

Thank you