Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Null Values

Status
Not open for further replies.

szeiss

Programmer
Apr 5, 2000
137
0
0
US
I have a formula called &quot;EstExp&quot; which is the following: {SUBPROJECT_SPENDPLAN_LINES.Q1_BUDGET_AMT}+{SUBPROJECT_SPENDPLAN_LINES.Q2_BUDGET_AMT}+{SUBPROJECT_SPENDPLAN_LINES.Q3_BUDGET_AMT}+{SUBPROJECT_SPENDPLAN_LINES.Q4_BUDGET_AMT}.&nbsp;&nbsp;I then do a running total on &quot;EstExp&quot;.&nbsp;&nbsp;In some cases I get a blank record, so I'm assuming that for some of these fields there isn't a record to evaluate.&nbsp;&nbsp;I've tried using IsNull, but can't seem to get it right.&nbsp;&nbsp;Can anyone help.<br><br>Thanks,<br>Sherry
 
If you have any null value in group of numbers you are adding, you get a null as a result.&nbsp;&nbsp;This is because a null value is the logical equivalent of &quot;unknown&quot;, so any number added to an &quot;unknown&quot; number results in an &quot;unknown&quot; value.<br>If you want to treat nulls as zeros, then the following formula will do that.<br><br>NumberVar YearBudget := 0 ;<br>If Not IsNull({SUBPROJECT_SPENDPLAN_LINES.Q1_BUDGET_AMT}) then YearBudget := YearBudget + {SUBPROJECT_SPENDPLAN_LINES.Q1_BUDGET_AMT} ;<br>If Not IsNull({SUBPROJECT_SPENDPLAN_LINES.Q2_BUDGET_AMT}) then YearBudget := YearBudget + {SUBPROJECT_SPENDPLAN_LINES.Q2_BUDGET_AMT} ;<br>If Not IsNull({SUBPROJECT_SPENDPLAN_LINES.Q3_BUDGET_AMT}) then YearBudget := YearBudget + {SUBPROJECT_SPENDPLAN_LINES.Q3_BUDGET_AMT} ;<br>If Not IsNull({SUBPROJECT_SPENDPLAN_LINES.Q4_BUDGET_AMT}) then YearBudget := YearBudget + {SUBPROJECT_SPENDPLAN_LINES.Q4_BUDGET_AMT} ;<br>YearBudget<br> <p>Malcolm Wynden<br><a href=mailto:wynden@island.dot.net>wynden@island.dot.net</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top