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

in Crystal XI, next(fid) & OnLastRecord

Status
Not open for further replies.

kratz

Programmer
Nov 17, 2006
35
US
What results are returned for
IF fid <> NEXT(fid)
when there is no "next" row? thatis, the fid is already in the last/final row?
I tried pairing the above inequality with
"not OnLastRocord" but it behaves like I might expect
if the NEXT(fid) part was returning a null resulting in
an undefined condition.
 
Yes, you would get a null, so check this way:

if nextisnull({table.field}) or
{table.field} <> next({table.field}) then //etc.

-LB
 
Thank you.
(I didn't even know there was a nextisnull function.)
The formula I designed says something like this:
IF FID <> NEXT(FID)
THEN 0
ELSE
IF DATE IN BEGINDATE TO ENDDATE
THEN 1;
So adding "OR nextisnull(fid)" to the first IF would yield invalid results if the fid isn't duplicated and the date fits.
If I turn on ReportOption of "Convert Other NULL Values to Default", would/should that enable my original IF inequality function both for normal rows and for the final row record?
 
What exactly are you trying to do? Is this your entire formula? Please explain.

-LB
 
Thank you for your patience.
It's very complicated. Any input transaction can have any number of joined rejection rows. User wants to count all distinct rejection events in the time period in addition to all initial transactions in the time period. Distinctness of the rejection event is defined by a unique reentry time within a transactionid.
The formula works perfectly except that it doesn't count the last/final record.

WhilePrintingRecords;
local NumberVar t;

if {FINGERPRINT_TRANSACTION.TRANSACTIONID} <> next({FINGERPRINT_TRANSACTION.TRANSACTIONID})
then t:=0
else
if ({FINGERPRINT_TRANSACTION.TRANSACTIONSTARTTIME}in {@minDate}to{@maxDate}) or OnLastRecord or
({FINGERPRINT_TRANSACTION.CARDRECEIPTTIME}in {@minDate}to{@maxDate}
and {FINGERPRINT_TRANSACTION.CARDRECEIPTTIME}<{FINGERPRINT_TRANSACTION.TRANSACTIONSTARTTIME})
then t:=1
else t:=0;

if {FP_TRANSACTION_REJECTION.REENTRYDATE}in {@minDate}to{@maxDate} and
({FP_TRANSACTION_REJECTION.REENTRYDATE}<> next ({FP_TRANSACTION_REJECTION.REENTRYDATE})or
OnLastRecord or
{FINGERPRINT_TRANSACTION.TRANSACTIONID}<>next({FINGERPRINT_TRANSACTION.TRANSACTIONID}))
then t:=t+1;

t
 
Try just changing the order of your clauses in the last section like this:

if {FP_TRANSACTION_REJECTION.REENTRYDATE} in {@minDate}to{@maxDate} and
(
OnLastRecord or
{FP_TRANSACTION_REJECTION.REENTRYDATE}<> next ({FP_TRANSACTION_REJECTION.REENTRYDATE})or
{FINGERPRINT_TRANSACTION.TRANSACTIONID}<>next({FINGERPRINT_TRANSACTION.TRANSACTIONID})
)then
t:=t+1;

I think it can't evaluate the next on the last record, so the if/then has to test the onlastrecord first.

-LB
 
Thank you.
Here's what appears to be working right:

WhilePrintingRecords;
local NumberVar t;

if OnLastRecord then t:=9;

if t=0 and //(not (nextisnull({FINGERPRINT_TRANSACTION.TRANSACTIONID}))) and
{FINGERPRINT_TRANSACTION.TRANSACTIONID} = next({FINGERPRINT_TRANSACTION.TRANSACTIONID})
then t:=0
else
if ({FINGERPRINT_TRANSACTION.TRANSACTIONSTARTTIME}in {@minDate}to{@maxDate}) or
({FINGERPRINT_TRANSACTION.CARDRECEIPTTIME}in {@minDate}to{@maxDate}
and {FINGERPRINT_TRANSACTION.CARDRECEIPTTIME}<{FINGERPRINT_TRANSACTION.TRANSACTIONSTARTTIME})
then t:=1
else t:=0;

if {FP_TRANSACTION_REJECTION.REENTRYDATE}in {@minDate}to{@maxDate} and
({FP_TRANSACTION_REJECTION.REENTRYDATE}<> next ({FP_TRANSACTION_REJECTION.REENTRYDATE})or
OnLastRecord or
{FINGERPRINT_TRANSACTION.TRANSACTIONID}<>next({FINGERPRINT_TRANSACTION.TRANSACTIONID}))
then t:=t+1;

t
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top