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 Question 2

Status
Not open for further replies.

Hashiba14

MIS
May 14, 2007
29
US
I have been trying to debug this code and have finally give up. Please see if you can point me in the right direction.
I'm using Crystal 10.

I have a field in my report called emp_pre_cont and this field usually has a number most of the time, but there are occasions when there are no values whatsoever. If there is a number value in this field, I have a formula that will calculate a retirement bonus, but if it doesn't have a value, I would like it to say 0.00.

Here are my 3 formulas:
1. Value Check:
if isnull({BENEFIT.EMP_PRE_CONT}) then '0.00'
else ({@Retirement Pension})

2. Retirement Pension:
(({EMPLOYEE.PAY_RATE}*{EMPLOYEE.NBR_FTE}*{EMPLOYEE.ANNUAL_HOURS})*.0575)

3. 403b Sum Calculation:
whileprintingrecords;
shared numbervar CompPensionTotal:=sum ({@Retirement Pension });

My problem is that when there is a value, I can pull it alright, but when its 0.00, nothing appears.
Suggestions...

Thanks
 
Your last response shows information about fields that are not shown in your sample. I am totally lost.

Please identify the report sections and subreports so that we can see how:

Ex. Account 12456 Account 31130

Benefit 85.00 Benefit 85.00
Retirement 2500.00
Total 2585.00 Life Insurance 210.00
Total 295.00

...relates to this:

GF3b = Pension (Subreport)sharednumbmer var CompPenionTotal
GF3c = Taxes (Subreport) sharednumber var CompTotal
GF3d = Paid Time off (Subreport) sharednumber var CompPTOTotal
GF3e = Annual Salary (Calculation)

I see no relationship whatsoever.

-LB
 
I'm sorry, I was just giving you a sample size of the entire report. Here are the entire contents of the report.

Account 13312 Group Header 1 = Employee
Dept 92000 Group Header 2 = Department
Benfits Class A Group Header 3 = Benefits

Benefits 85.00 (Detail Section of Main Report)
Retirement Pension 3000.00 (Group Footer 3b)
Medicare and SS 3000.00 (Group Footer 3c)
PTO 2500.00 (Group Footer 3d)
Annual Salary 52000.00 (Group Footer 3e)

Total 60585.00

There are a total of 3 Subreports: one for pension, taxes and PTO.

The shared variable for retirement is CompPensionTotal
The shared variable for taxes is Comptotal
The shared varialbe for PTO is CompPTOTotal

In Group Footer 1, the formula that calcuates everything is:
whileprintingrecords;
shared numbervar Comptotal;
shared numbervar CompPTOTotal;
shared numbervar CompPensionTotal;

Comptotal + CompPTOTotal + CompPensionTotal + Sum ({BENEFIT.COMP_CONT}, {BENEFIT.EMPLOYEE})+{@Annual Salary}

Group Footer 2 is left blank and surpressed.

After going through everything, I noticed that the accounts that show up as blank lines, do not even have any instance of a pension on their account whatsoever. I do not know if this is the reason why the null values have had no effect.

I hope this helps clarify and you can provide a solution...
thank you

 
In your GF1 formula:

whileprintingrecords;
shared numbervar Comptotal;
shared numbervar CompPTOTotal;
shared numbervar CompPensionTotal;

Comptotal + CompPTOTotal + CompPensionTotal + Sum ({BENEFIT.COMP_CONT}, {BENEFIT.EMPLOYEE})+{@Annual Salary}

...try commenting out each component of the calculation so you can identify which one is null. It sounds like it will be "compPensionTotal".

It still seems like putting the reset formula in a new GF31 or in GH3 should do the trick. If in GH3, you should change it to:

whileprintingrecords;
shared numbervar Comptotal;
shared numbervar CompPTOTotal ;
shared numbervar CompPensionTotal ;
if not inrepeatedgroupheader then
(
Comptotal := 0;
CompPTOTotal := 0;
CompPensionTotal := 0
);

-LB
 
Thank you very much, that solved the problem, putting the reset formula in the group header.

Works like a charm, thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top