comaring two values ??

make

Member
Hi,
i want to compare to value in afield.
expample:

Milk
------
100
100
200
400

i find the value 100 ( the first) , then i want to read the next value, end then compare the both values. If they are the same, then do :....., else do : ........!

Can anyone help me ?

Make
 
U

Unregistered

Guest
Are you trying to compare all the records in a table in order? If so, then I would recommend the following:

FOR EACH Milk NO-LOCK
BREAK BY MilkCode:
IF FIRST(MilkCode) THEN NEXT. /* Nothing to compare to yet */
IF FIRST-OF(MilkCode) THEN
/* Not the same */
ELSE
/* The same as previous */
END.
 

m1_ru

New Member
<pre>
for each atable
break by atable.afield
:
if first-of( atable.afield ) then do:
/* process first record of each group */
end.

/* process each record */

if last-of( atable.afield)
and not first-of( atable.afield)
then do:
/* process last record of each group */
/* that contains more than one record */
end.

if last-of( atable.afield ) then do:
/* process last record of each group */
end.
end.
</pre>
 
Top