Can somebody help me, i'm simply trying to add 4 database fields, some fields may contain null/blank values...
but i can't get my formula to add the 4 fields properly, here's my code :
----------------------------------------------------------
NumberVar var1;
NumberVar var2;
NumberVar var3;
NumberVar var4;
NumberVar Result;
var1 := {sp_SaleProjRpt;1.gross_q1};
var2 := {sp_SaleProjRpt;1.gross_q2};
var3 := {sp_SaleProjRpt;1.gross_q3};
var4 := {sp_SaleProjRpt;1.gross_q4};
If IsNull ({sp_SaleProjRpt;1.gross_q1}) Then
var1 := 0
Else If IsNull ( {sp_SaleProjRpt;1.gross_q2}) Then
var2 := 0
Else If IsNull ({sp_SaleProjRpt;1.gross_q3}) Then
var3 := 0
Else If IsNull ({sp_SaleProjRpt;1.gross_q4}) Then
var4 := 0
Else
Result := var1 + var2 + var3 + var4;
Result;
It only gives me a "Result" if all 4 database fields contains value, if at least 1 of the fields does not contain values, then it gives me a blank "Result"
thanks!
but i can't get my formula to add the 4 fields properly, here's my code :
----------------------------------------------------------
NumberVar var1;
NumberVar var2;
NumberVar var3;
NumberVar var4;
NumberVar Result;
var1 := {sp_SaleProjRpt;1.gross_q1};
var2 := {sp_SaleProjRpt;1.gross_q2};
var3 := {sp_SaleProjRpt;1.gross_q3};
var4 := {sp_SaleProjRpt;1.gross_q4};
If IsNull ({sp_SaleProjRpt;1.gross_q1}) Then
var1 := 0
Else If IsNull ( {sp_SaleProjRpt;1.gross_q2}) Then
var2 := 0
Else If IsNull ({sp_SaleProjRpt;1.gross_q3}) Then
var3 := 0
Else If IsNull ({sp_SaleProjRpt;1.gross_q4}) Then
var4 := 0
Else
Result := var1 + var2 + var3 + var4;
Result;
It only gives me a "Result" if all 4 database fields contains value, if at least 1 of the fields does not contain values, then it gives me a blank "Result"
thanks!