1 Reply Latest reply on Feb 13, 2010 5:58 AM by try67

# Calculation that results in a 0 is null

Hi:

I have an issue when the results of a calculation = 0, the field is considered to have a null value.

For example:

I have a number of columns and rows in a table.

the desired result is to have the last entry in the table as the first entry in the next table.

the last entry column has a calculation in each row of

var a = this.getField("JanE.5");
var b = this.getField("JanF.5");
var c = this.getField("JanG.5");
var d = this.getField("JanDay.5").value;

if(d != "")
{
event.value = a.value - b.value - c.value;
}

else

{

event.value="";

}

In the first column of the second table selects the last row of the first table that has a value and takes its value.

var a = this.getField("JanH.5").value;
var b = this.getField("JanH.4").value;
var c = this.getField("JanH.3").value;
var d = this.getField("JanH.2").value;
var e = this.getField("JanH.1").value;
var f = this.getField("JanH.0").value;

if(a == 0 || a > 0 && b == 0 || b > 0 && c == 0 || c > 0 && d == 0 || d > 0 && e == 0  || e > 0 && f == 0 || f > 0)
{
event.value = a || b || c || d || e || f
}

This works for all values except when the calculation = 0.  In this case it selects the next value

Table 1 values are

("JanH.5").value - Null

("JanH.4").value - 0

("JanH.3").value - 1

("JanH.2").value - 102

("JanH.1").value - 1101
("JanH.0").value - 5545

The value for the field is 1 when it should be 0.  this happens for all cells.

How can I get the cell value to be 0 like it should be?

I tried multiplying the values by 1 to force it to a numeric 0 value but this doesnt work.