How to compare record with the previous record?

hai all

I want to ask you something, How to compare record with the previous record on a form?

for example like this :

document no new

DOC001 yes

DOC001 no

DOC001 no

DOC002 yes

DOC002 no

so every new document, the new field should be yes

thanks

Try this code in OnAfterGetRecord and OnAfterGetCurrRecord:

Record.copy(Rec);

if not Record.next(-1) then

New := true

else

New := Record.“Document No.” <> “Document No.”

My code

Form - OnAfterGetRecord()
TransferOrder.copy(Rec);
if NOT TRansferOrder.next(-1) then
Status := true
else
Status := TransferOrder.“Location Code” <> “Location Code”

error message : This prefix operator cannot be used on integer

Sorry:

TransferOrder.copy(Rec);
if TRansferOrder.next(-1) = 0 then
Status := true
else
Status := TransferOrder.“Location Code” <> “Location Code”

Nice Valentin !!

it works …

thanks a lot :slight_smile:

I’m sorry… I forget to add this

how about if I want to add increasing number from no series

document no new no

DOC001 yes 1

DOC001 no 1

DOC001 no 1

DOC002 yes 2

DOC002 no 2

I get number series from here

NoSeriesLine.SETRANGE(NoSeriesLine.“Series Code”,‘T-ORD’,‘T-ORD’);

(INCSTR(NoSeriesLine.“Last No. Used”)

This can reduce performance… Are you sure you want do this?

yes … no problem