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!

Running total formula ignores first record. 1

Status
Not open for further replies.

NBVC

Technical User
Sep 18, 2006
80
CA
Hi All,

I have a running total in my report that evaluates based on a formula as follows:

Code:
NOT(({RECEIVER.PURC_ORDER_ID}= previous({RECEIVER.PURC_ORDER_ID})) and ({PURC_ORDER_LINE.LINE_NO}= previous({PURC_ORDER_LINE.LINE_NO})))

It works most of the time, but it omits including the very first record in the running total sum. Is there something I should add to the formula to ensure the first record is not trying to check for a previous record?
 
the first record has no previous record, so you need to tell crystal what to do with it.

maybe something like:

IF onfirstrecord=TRUE
then
{table.fieldvalue}
else
NOT(({RECEIVER.PURC_ORDER_ID}= previous({RECEIVER.PURC_ORDER_ID})) and ({PURC_ORDER_LINE.LINE_NO}= previous({PURC_ORDER_LINE.LINE_NO})))
 
I am not certain what to substitute {table.fieldvalue} with?
 
I tried this, to no avail though.... :(

Code:
if Not onfirstrecord then
NOT({PURC_ORDER_LINE.PURC_ORDER_ID}= previous({PURC_ORDER_LINE.PURC_ORDER_ID}) and {PURC_ORDER_LINE.LINE_NO}= previous({PURC_ORDER_LINE.LINE_NO}))
 
Try this instaed:

if onfirstrecord or
NOT({PURC_ORDER_LINE.PURC_ORDER_ID}= previous({PURC_ORDER_LINE.PURC_ORDER_ID}) and {PURC_ORDER_LINE.LINE_NO}= previous({PURC_ORDER_LINE.LINE_NO}))
 
Try:

Code:
OnFirstRecord or
NOT	(
		({RECEIVER.PURC_ORDER_ID}= previous({RECEIVER.PURC_ORDER_ID})) and 
		({PURC_ORDER_LINE.LINE_NO}= previous({PURC_ORDER_LINE.LINE_NO}))
	)

Cheers
Pete
 
Thanks Pete. That one worked :)

Charliy, yours prompted an error looking for "then"...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top