SOS

Posted by Siliot Mawire on 20-May-2016 03:21

I need a code that allows me to save my record and return control to the calling form. I have a main frame with and Add button. When I click the ADD button the system should create a record with an overlay dialog form to fill-in. when I click UPDATE on this dialog box I need it to save the record and return to the calling form.

All Replies

Posted by smat-consulting on 20-May-2016 06:58

Are you trying to do this in a browser based web-app, in regular GUI or .NET? One of the biggest advantages of OpenEdge is that you can work for all kinds of environments (except apple ). So, when asking a question, it is important to always define the scenario clearly...

Posted by Siliot Mawire on 20-May-2016 08:08

Odinary GUI enviroment for a simple Windows application


On Friday, 20 May 2016, 13:59, smat-consulting <bounce-smat-consulting@community.progress.com> wrote:


Update from Progress Community
smat-consulting
Are you trying to do this in a browser based web-app, in regular GUI or .NET? One of the biggest advantages of OpenEdge is that you can work for all kinds of environments (except apple ). So, when asking a question, it is important to always define the scenario clearly...
 
You received this notification because you subscribed to the forum.  To unsubscribe from only this thread, go here.
Flag this post as spam/abuse.


Posted by Siliot Mawire on 20-May-2016 08:10

Here is my code:
session:DATA-ENTRY-RETURN = TRUE.
DEFINE QUERY qry-dbsgr FOR dbsgr scrolling.
 
DEF VAR Current-Record AS ROWID.
DEF VAR method-status AS LOGICAL.
 
DEF BROWSE brw-dbsgr QUERY qry-dbsgr
    DISPLAY Sgrp  Ctrledger Descrip WIDTH 80
    /* ENABLE Sgrp Descrip Ctrledger */
    WITH 20 DOWN SEPARATORS.
 
DEF BUTTON btn-Add   LABEL "ADD".
DEF BUTTON btn-del   LABEL "DELETE".
DEF BUTTON btn-exit  LABEL "CLOSE".
DEF BUTTON btn-Edit  LABEL "EDIT".
DEF BUTTON btn-close LABEL "CLOSE".
DEF BUTTON btn-ok    LABEL "OK".
 
define rectangle rect-1
     edge-pixels 2 graphic-edge  no-fill
     size 116 by 2.3.
 
define rectangle rect-2
     edge-pixels 2 graphic-edge  no-fill
     size 116 by 18.5.
 
define frame frm-input
    dbsgr.sgrp        colon 30 label "Service Code"
    dbsgr.descrip    colon 30 label "Description"
    dbsgr.Ctrledger   colon 30 label "Control Ledger"
    skip(0.5)
    btn-ok colon 5
    btn-close colon 60
    with view-as dialog-box keep-tab-order no-validate
         side-labels no-underline three-d scrollable.
   
 
DEF FRAME frm-dbsgr
    brw-dbsgr AT ROW 2 COL 5
    btn-add AT ROW 20.7 COL 5
    Space(20) btn-edit
    space(20) btn-del
    space(20) btn-exit SKIP(1)
    rect-2 AT ROW 1.4 COL 3
    rect-1 AT ROW 20 COL 3
    WITH 1 DOWN OVERLAY SIDE-LABELS CENTERED THREE-D
    ROW 2 SIZE 150 BY 22
    TITLE "Services Control Data Capture".
 
ON LEAVE OF dbsgr.sgrp
DO:
    IF INPUT dbsgr.sgrp <> 0 THEN DO:
        FIND FIRST dbsgr WHERE dbsgr.sgrp = INPUT sgrp NO-ERROR.
        IF AVAILABLE dbsgr THEN DO:
            MESSAGE "Record already exist" VIEW-AS ALERT-BOX.
            RETURN NO-APPLY.
        END.
    END.   
END.
 
ON CHOOSE OF btn-Add DO:
/* Method-Status = brw-dbsgr:INSERT-ROW("AFTER"). */
    view frame frm-input.
    clear frame frm-input no-pause.
    enable all with frame frm-input.
    CREATE dbsgr.
    UPDATE Sgrp Descrip Ctrledger WITH FRAME frm-input.
    APPLY 'entry' TO dbsgr.sgrp.
    WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW FOCUS DBSGR.SGRP.
END.
 
on 'choose' of btn-close or
    'window-close','esc','f4' of frame frm-input
do:
    hide frame frm-input no-pause.
    view FRAME frm-dbsgr.
    OPEN QUERY qry-dbsgr FOR EACH dbsgr NO-LOCK.
    ENABLE ALL WITH FRAME Frm-dbsgr.
    WAIT-FOR CHOOSE OF btn-Exit OR close of THIS-PROCEDURE.
end.
 
/* ON CHOOSE OF btn-ok
DO:
     CREATE dbsgr.
      ASSIGN dbsgr.sgrp = int(sgrp:SCREEN-VALUE)
             dbsgr.descrip = STRING(descrip:SCREEN-VALUE)
             dbsgr.ctrledger = dec(ctrledger:SCREEN-VALUE).
      CLEAR FRAME frm-input NO-PAUSE.
    RETURN.
END.
 */
on 'choose':u of btn-ok
do:
     
         do transaction:
             create dbsgr.
              pause 0.
             release dbsgr.
             end.
             MESSAGE "Yes" VIEW-AS ALERT-BOX.
             HIDE FRAME frm-input.
                apply 'close' to frame frm-input.
           
END.
    
 
ON ROW-LEAVE OF BROWSE brw-dbsgr DO:
    IF brw-dbsgr:NEW-ROW IN FRAME frm-dbsgr THEN DO:
        CREATE dbsgr.
        ASSIGN INPUT BROWSE brw-dbsgr Sgrp Descrip Ctrledger.
        /*7*/ Method-Status = brw-dbsgr:CREATE-RESULT-LIST-ENTRY().
        /*8 DISPLAY Item-Num WITH BROWSE Item-Browse. */
    END.
END.
 
ON CHOOSE OF btn-Del DO:
    GET CURRENT qry-dbsgr EXCLUSIVE-LOCK NO-WAIT.
    DELETE dbsgr.
    Method-Status = brw-dbsgr:DELETE-SELECTED-ROWS().
END.
 
/********** MAIN LOGIC **********/
OPEN QUERY qry-dbsgr FOR EACH dbsgr NO-LOCK.
ENABLE ALL WITH FRAME Frm-dbsgr.
WAIT-FOR CHOOSE OF btn-Exit OR close of THIS-PROCEDURE IN FRAME frm-dbsgr.
CLOSE QUERY qry-dbsgr.
HIDE FRAME frm-dbsgr.
 
Please help.
 
Siliot
 

This thread is closed