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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IsNull is not working

Status
Not open for further replies.

yehong

Programmer
Sep 22, 2003
291
US
I am using CR8.5.
I have 4 running totals that sum salary of an individual by month. I have hardcoded Month in each running total. For now I have only 4 running totals so I am running my report for Jan, Feb, Mar and April.
I have a formula on the report say
//@SumOfMonths
If {table.month}=2 Then [#jansalary} Else
If {table.month}=3 Then [#jansalary}+[#febsalary} Else
If {table.month}=4 Then [#jansalary}+[#febsalary}+[#marsalary}

The problem is I think formula is not evaluationg at all for any condition and returning "". I have tried IsNull at different places but still it is not giving zero when someone's salary is zero. Any idea?
 
You might want to substitute the following type of clause in parentheses for EACH running total in your formula, as in:

...then (if isnull({#jansalary}) then 0 else {#jansalary}) + (if isnull({#febsalary}) then 0 else {#febsalary}) else...

-LB
 
dgillz,
Month number is passed as a parameter, so if we are running the report for month 3, then it will be sum of jan+feb salaries and I think salary fields may be null for some months.

lbass,
I tried that too but it didn't work. It works If I have separate formulas for each month then it works and returns zero if it finds null salary.
//@March
if isnull({#jansalary}) then 0 else {#jansalary}) + (if isnull({#febsalary}) then 0 else {#febsalary})

But when I combine those separate formulas in one, it does not work.
 
It should work. You might double check your parens. If you still have problems, try posting your entire formula here.

-LB
 
here is my formula and after inserting brackets, it still does not return zeros for nulls.

If {YTD_SALARY.Mo_NO}=4 Then
(If IsNull({#m1}) Then 0 Else {#m1})+(If IsNull({#m2}) Then 0 Else {#m2})+ (If IsNull({#m3}) Then 0 Else {#m3})
Else
If {YTD_SALARY.Mo_NO}=3 Then
(If IsNull({#m1}) Then 0 Else {#m1})+(If IsNull({#m2}) Then 0 Else {#m2})
Else
If {YTD_SALARY.Mo_NO}=2 Then
(If IsNull({#m1}) Then 0 Else {#m1})
Else
If {YTD_SALARY.Mo_NO}=1 Then
(If IsNull({#m1}) Then 0 Else {#m1})
 
This works when I test it here. How do you have the running totals set up?

-LB
 
Here is my running total detail:
//m1
Field to Summarize: YTD_SALARY.Salary
Type of Summary:Sum
Evaluate: Formula {YTD_SALARY.MO_NO}=1
Reset: On Change of Group (there are three groups in my report and I am reseting and displaying it for third group, i-e Job Title).
 
I'm not sure it's relevant to the issue, but what are your other groups, in order?

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top