Reputation: 1
we are new one for progress, we like to retrive a particular record in the existing db, fox ex: if we have a 500 records in that record i need to retrive exactly one record. for this what can i do..? please help us with sample code..
we fetch our code here..
def var sum as int.
def var a as int no-undo.
def var i as int no-undo.
for each po_mstr break by po_nbr. /select count from po_mstr./ assign a = 583.
if first-of (po_nbr) then
do i = 1 to a:enter code here if (i = 1) then sum = sum + 1.
if (sum = 400)
then disp po_nbr po_vend po_ship po_ord_date.
end.
end.
Upvotes: 0
Views: 68
Reputation: 14020
You need a WHERE clause in your FOR EACH statement.
For example if you want po-nbr 123 you might code:
FOR EACH po_mstr NO-LOCK WHERE po_mstr.po_nbr = 123:
DISPLAY
po_nbr po_vend po_ship po_ord_date
.
END.
Also -- if you only want a single, unique record you could code:
FIND po_mstr NO-LOCK WHERE po_mstr.po_nbr = 123 NO-ERROR.
IF AVAILABLE( po_mstr ) THEN
DISPLAY
po_nbr po_vend po_ship po_ord_date
.
Upvotes: 2