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

Last Record In Report Shows Null Value

Status
Not open for further replies.

redtoad

Programmer
Jan 28, 2002
51
US
I have a report that sums the instances of three conditions. On the last record in the report, CR shows the value as null, enen though there is an instance that it should count.

As a result the sum of the instances is off by one.

Any Ideas?
 
What are the conditions? Does one rely on the NEXT() function? Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Here's my formula - works perfectly except for on the last record of the report. If I unsuppress this field, and the last record has a POS TYPE of "New", the field passes a null value.

WhilePrintingRecords;
NumberVar New;
if {MWH_ORR.POS TYPE}='New' and {MWH_ORR.REQ NUMBER} <> next({MWH_ORR.REQ NUMBER}) then
New:=New+1
else New:=New+0;
 
*******************************

WhilePrintingRecords;
NumberVar New;
if {MWH_ORR.POS TYPE}='New' and {MWH_ORR.REQ NUMBER} <> next({MWH_ORR.REQ NUMBER}) then
New:=New+1
else New:=New+0;

********************************

The reason that it is failing on the last record is that you are looking &quot;forward&quot; to the &quot;next&quot; value which is null on the last record. Since it is null this complete formula will fail on the last record.

to fix it try this

WhilePrintingRecords;
NumberVar New;
if (NextIsNull({MWH_ORR.REQ NUMBER}) and {MWH_ORR.POS TYPE}
='New') OR ({MWH_ORR.REQ NUMBER} <> next
({MWH_ORR.REQ NUMBER}) and {MWH_ORR.POS TYPE}
='New') then
New:=New+1
else
New:=New+0;

Hope this helps

Jim
JimBroadbent@hotmail.com
 
You can also use:

If OnLastRecord... Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
I used Ngolem's suggestion and it worked great. I tried to use OnLastRecord before and couldn't get it to work, I probably didn't use it correctly.

Thanks to Jim and Ken for there help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top