Question Dynacmic Frame

Naveen Sharma

New Member
Hi guys,
I am new to Progress forum and this is my first post.

I am trying to develop a small maintenance program where the input frame will contain 1 dept and each department will have 3 managers. User will be updating all the 4 fields.

I have written the following code :

Code:
        UPDATE  AML1 VALIDATE(INPUT AML1 <> "" AND CAN-FIND(employee WHERE employee.domain = global_domain
                                                    AND employee.Employeecode = INPUT AML1
                                                    AND employee.divdept = divdept), "Invalid Employee!Please Re-enter.") WITH FRAME f1                                     
          EDITING: 
                   IF(FRAME-FIELD = "AML1") THEN
                           DO:
                              {mfnp.i employee AML1 "employee.domain = global_domain and employee.divdept = pdivdept.divdept and employee.Employeecode" AML1 employee.employeecode employee_idx1}
                              IF recno <> ? THEN DO:
                                                     DISPLAY employee.employeecode @ AML1
                                                             NAME @ L1name WITH FRAME f1.   
                                                 END.  /* if rec no <> ? */ 
                           END. /* end of if frame field = AML1 */
              END. /* end of editing AML1 */
          FIND FIRST employee WHERE employee.domain = GLOBAL_domain
                                 AND employee.divdept = divdept
                                 AND employee.employeecode = AML1 NO-LOCK NO-ERROR .
         IF AVAILABLE employee THEN DO:
                                       ASSIGN AML1 = employee.employeecode
                                              L1name = employee.NAME .
                                       DISPLAY employee.employeecode @ AML1
                                               employee.NAME @ L1name WITH FRAME f1.     
                                    END.

where AML1 is 1 manager. The same code has to be repeated 3 times for 3 managers.
Since i dont want to repeat the same code I am trying to put the same in a internal procedure and pass AML1 as an input-output parameter which is not working . Can somebody help me out??
 
Last edited by a moderator:

Cringer

ProgressTalk.com Moderator
Staff member
If you surround code with [code][/code] tags it's easier to read. I'll update yours for you so you see what I mean.
 

GregTomkins

Active Member
This may not be helpful, but that code is full of things which are generally frowned upon these days. EDITING is 1970's, and I'm not sure why you need it here?, and include files, especially with arguments, aren't much better. I am guessing you're doing something in CUI?

Not sure what's inside mfnp.i, but I'm guessing your main issue is that you don't want to triplicate that VALIDATE clause. VALIDATE is also kind of 1970's (maybe 1980's), and generally speaking, if I had to do something CUI, after time-travelling myself back to 1973 I might do something like this:

Code:
UPDATE manager[1] manager[2] manager[3].
DO loop = 1 TO 3:
 RUN int_validate_manager(manager[loop]).
END.
PROCEDURE int_validate_manager:
 DEF INPUT PARAM p_manager AS CHAR NO-UNDO.
 IF CAN-FIND ... etc.
END.

Arrays are also frowned on in some circles though in this example, I wouldn't have a problem with it. Anyway, HTH a little.
 

Naveen Sharma

New Member
Hi Greg,

Yes I am using Character Interface. I am using mfnp.i for scrolling purpose i.e on press of down/p arrow the next and prev data gets displayed.
I need to store the entered data in a new custom table.

Thank you for your suggestion and I will try it out using arrays. But if any one can give me another solution where I can use an internal procedure to
call the same piece of code 3 times.

When i tried using internal procedure a frame issue was appearing i.e the frame defined at the starting of the program was not available to use in the
procedure.
 
Top