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!

Formula throwing up an error after a couple of years

Status
Not open for further replies.

sprog

IS-IT--Management
Sep 12, 2002
48
NZ
Hello there

I have a formula in one of my reports:
whileprintingrecords;
numbervar result;
result := truncate({@Balance});
if {@Balance} - result >= 0.5 then
result := result +0.5;
result;

I have been using this report for a couple of years now and just "refresh" after each pay fortnight. Today it is not working and brings the formula up on the screen with the ({@balance}) part highlighted (beside truncate).

My report lists current annual leave balances per cost centre and is only bringing up 2 of the 8 cost centres - with this error for the other 6? I am very confused?

Why is it still working for 2 of them, but not the others?

Any suggestions would be appreciated.

Thanks
Julie
 
What is the error message you are getting? What is the content of {@balance} (and of any nested formulas)?

-LB
 
When I hit refresh, the first two pages of my report are fine, and then when I go to page 3 onwards it automatically flicks back into the Formula Workshop Area, and over on the left hand side there is a Folder called
"Error"
under that is
X.1 Rounded
and then under that is
{@Balance} 11.1304945055
and under that is
var result:9.5

The formula for @Balance is:
({@Accrued} + {EmployeeLeave.ALOutstanding}) - {EmployeeLeave.ALAdvanced}

The formula for @Accrued is:
(52 - (({EmployeeLeave.ALNextEntitlementDueDate} - {EmployeeLeave.LeaveAccruedTo})) / 7) * ({EmployeeLeave.ALNextEntitlement} / {EmployeeLeave.ALNextEntitlementWeeks})

My report is basically pulling accrued leave, plus leave outstanding minus leave taken in advance to give the numbe of annual leave days an employee has owing to them.

Sorry for the delay in replying. I am flat out at work.

Julie
 
Could {EmployeeLeave.ALNextEntitlementWeeks} be zero? Division by zero normally gets reported as such, but since you are using variables it may be different.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 10 & 11.5 with Windows XP [yinyang]
 
There should be an error message that accompanies the return to the formula area. What does it say?

-LB
 
Thanks for your replies.

Yes, it just comes back with this:

"Error"
under that is
X.1 Rounded
and then under that is
{@Balance} 11.1304945055
and under that is
var result:9.5

Thanks
Julie
 
Usually there is a popup message--not just the info on the left. Try going into file->report options and check "convert nulls to default values"--see if this corrects the problem--that would mean that one or more of your fields in the formula contains a null.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top