Report Pgm, Doubt(have included the code)just rewrite it.

reenageorge5

New Member
Hi,

If anybody knows reply me..
Bolow given is the code i have written for getting the details of an item from tables pt_mstr & tr_hist when user enters the item code(pt_part) (where pt_mstr.pt_part=tr_hist.tr_part).But i want to repeat the same for several times (if user wants).i want a dialog box asking do you want to repeat?
Once user select yes for it the same procedure should repeat....Is there any statement in Progress like GO TO in Other languages to return the ctrl to a particular stmt in pgm, so that i can repeat it once user selects yes. :confused::confused::confused:
Define Variable code like pt_part.
Define Variable ans as Logical Format "yes/no" No-Undo.
Define Temp-Table result field ptpart like pt_mstr.pt_part
field ptprodline like pt_prod_line
field ptchr05 like pt_mstr.pt__chr05
field trpart like tr_hist.tr_part
field trtype like tr_hist.tr_type
field trdate like tr_hist.tr_date
field ptstatus like pt_status
field ptprice like pt_price
field ptordqty like pt_ord_qty
field ptrop like pt_rop
field trqtyreq like tr_qty_req
field trqtyshort like tr_qty_short
field trshiptype like tr_ship_type.
Form header space (15)" **************ITEM DEATILS*************" WITH FRAME B.
Form "Item code:" ptpart space(15) "Transaction Type:" trtype SKIP(2)
"Date:" trdate SPACE(31) "Product Line:" ptprodline SKIP(2)
"CBU Code:" ptchr05 Space(27) "Price:" ptprice Skip(2)
"Ordered Quantity:" ptordqty space(17) "Re-Order Point:" ptrop skip(2)
"Status:" ptstatus space(29) "Quantity Required:" trqtyreq
Skip(2)
"Shortage:" trqtyshort space(23) "Ship Type:" trshiptype
with frame b 20 down width 100.

Prompt-For pt_mstr.pt_part Label "Item Number" WITH FRAME a CENTERED.
Assign code = Input pt_mstr.pt_part.
Find First pt_mstr where pt_mstr.pt_part = code NO-ERROR.
FInd first tr_hist where tr_hist.tr_part = code.
If avail pt_mstr Then
Create result.
ptpart = pt_part.
ptprodline = pt_prod_line.
ptchr05 = pt__chr05.
trpart = tr_part.
trtype = tr_type.
trdate = tr_date.
ptstatus = pt_status.
ptprice = pt_price.
ptordqty = pt_ord_qty.
ptrop = pt_rop.
trqtyreq = tr_qty_req.
trqtyshort = tr_qty_short.
trshiptype = tr_ship_type.
For each result:
Display ptpart
trdate
trtype
ptprodline
ptchr05
ptprice
ptstatus
ptrop
ptordqty
trqtyreq
trqtyshort
trshiptype
with frame b no-Labels.
Else Message "NOt Found.....".
END.
:(:(

Also is therein progrss any stmt like "Select Distinct" in SQL to avoid duplicate rows in a tables.
 
Greetings you need to play about with flags. This should get you started:/* vars */DEFINE VARIABLE lgQuit AS LOGICAL NO-UNDO./* block *//* initialize */ASSIGN lgQuit = FALSE. REPEAT WHILE lgQuit = FALSE:/* action block here *//* decide if user done enough to drop out, asses variables ... if all ok then drop out*/ASSIGN lgQuit = TRUE.END. /* lgQuit */
 
There are a number of approaches to do the kind of thing that you want ... I'm just not sure which version you want. One is to nest repeat blocks. In the outer one you prompt for the item number and in the inner one you display the records related to the item number. Below the inner loop you either just put a pause and let the user F4 out of the item prompt to quit or you can put a prompt for Another? and do a LEAVE if the answer is no.

Another approach is to prompt for a list of item numbers and then have a repeat block that selects one at a time with ENTRY() and runs the inner block for that item.

It all depends on what you want to do.

BTW, try posting code with [ pre ] and [ /pre ] (no spaces) to preserve indentation. Makes it easier to read.
 
Back
Top