1 / 16

- The PUG Challenge -

- The PUG Challenge -. Brynjar Hasle, Chemistry as www.chemistry.no Geir O. Olsen, THInc Consulting as. Case: PUG member system. Datamodel. Tools:. - Dynamic 4GL constructs 9.1d/10.0a AppServer (stateless) Aia client on webserver - Progress 8.x - 9.1/10.0a RDBMS. Basic Elements.

campbelll
Download Presentation

- The PUG Challenge -

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. - The PUG Challenge - Brynjar Hasle, Chemistry as www.chemistry.no Geir O. Olsen, THInc Consulting as

  2. Case: PUG member system

  3. Datamodel

  4. Tools: • - Dynamic 4GL constructs • 9.1d/10.0a AppServer (stateless) • Aia client on webserver • - Progress 8.x - 9.1/10.0a RDBMS

  5. Basic Elements Client: x.w y.w z.w UI_lib.p AS_lib.p Server: • Get data:-gettemptablejoin.p • -getfieldlist.p • getfieldvalues.p (FIND) • -gettemptable (input <fill>.p)-checkcurrentchanged.p Put data:-servertrans.p

  6. Server, get data: - gettemptablejoin.p:Input: - Buffers and fields - Query criteria - Startrow and number of rows to return Hooks for calculated fields (input .p’s for logic) Returns temp-table handle (and hence the data) • getfieldlist.p:Input: - Buffers and fields - Query criteriaReturns fieldlist (f.ex to populate drop-down) - gettemptable.p (input .p, output temp-table handle)

  7. Server, put data: • Trans.header: • Buffer • Operation • Field list • Opt.val.proc - servertrans.p:Input: - Trans header and trans values Temp-table struct Dynamic FK validation Hooks for custom validation / updates Assign defaults Returns completed temp-table (option) Trans.values: - Field value list

  8. AS_lib, main methods: • - GetTempTableJoin( Input: List of buffers and fields, rows-to-batch,startrow and query criteria). • Checks for appserver / client server and passes on the • input parameters pluss sessionid to gettemptablejoin.p • - DoCreate(Input buffer,fields and values). • - DoUpdate(Input buffer,criteria,fields and values). • DoDelete(Input buffer,criteria). • Populate transaction temp-tables. • - DoCommit(true/false). • Checks for appserver and passes transaction temp-tables to servertrans.p. True/False: receive completed buffer back

  9. UI_lib: • Implements standard events • and methods. Keeps run-time state for UI objects. • ”Objects” (currently): • InitBrowse(..) • -InitQuery(..) • -InitFieldMap(..) • (browse buffer pluss add. ttObject ttEvent ttObjectLink ttAttribute info on input/display fields) -InitToolbar(..) -InitBrowseDropDown(..) Standard methods: DisplayRecord, SaveRecord, OpenQuery,etc.

  10. Additional handy stuff: - ResizeLib.p - Dynamic lookup - src/adm2/dyntreeview.w (slightly altered) - from smartpak/adm2/cal.w (altered) - Microsoft OCX tab-folder • ..

  11. Coding example: Rectangles are used to represent screen objects that are created. In this example a toolbar and a browser. All relevant code for this simple window is in one procedure, InitWindow. Only the libraries (AS,UI and Resize are supporting this .w file – no includes).

  12. Procedure InitWindow: DO WITH FRAME {&FRAME-NAME}: hBrowse = DYNAMIC-FUNCTION("initBrowse", /* Create a browse object (New!) */ rectBrowse:HANDLE, /* Rectangle to define coordinates for browse */ 100, /* Rows to batch */ "", /* Browse properties, ie MULTIPLE,NUM-LOCKED-COLUMNS, etc */ "pccMemberShipType;MemberShipTypeName;MemberShipTypeCost", /* Buffers and fields: <buffer1>;<field1>;<field2>..,<buffer2>;.. No fields gives all*/ "WHERE iCompanyId = " + STRING(DYNAMIC-FUNCTION("getCompanyId")), ""). /* Misc - for something I might need in next version.. */ hFieldMap = DYNAMIC-FUNCTION("InitFieldMap", /* A fieldmap object holds extra info for display and input fields (fill-ins) and their corresponding buffer columns return handle equals the buffer handle */ hBrowse:QUERY, FRAME {&FRAME-NAME}:HANDLE, /* Frame for the input/display fields (might not be the same frame as the browse) */ "MemberShipTypeName,MemberShipTypeCost", /* Update columns in buffer */ "MemberShipTypeName,MemberShipTypeCost", /* Corresponding input fields (fill-in..)*/ "","", /* Additional buffer and displ.fields - not updateable*/ ""). /* Additional input fields (not in buffer) */ /* Assign foreign key values (not selected by the user): */ DYNAMIC-FUNCTION("setAttribute",hFieldMap,"bufferextrafields","iCompanyId"). DYNAMIC-FUNCTION("setAttribute",hFieldMap,"bufferextravalues",STRING(DYNAMIC-FUNCTION("getCompanyId"))). DYNAMIC-FUNCTION("InitToolBar", rectTBfile:HANDLE, /* Rectangle to define coordinates for toolbar */ "Fil", /* Corresponding menu label - no menu if blank */ "new;Ny,undo;Angre,delete;Slett,save;Lagre,excel;Eksporter til Excel", /* Buttons / Menu items: action;label;tooltip;Method;image,action;label.. Any number of properties accepted (one ok - if predef. action) */ "maxborder"). /* View and expand border rectangle to span frame */ DYNAMIC-FUNCTION("LinkAllObjects", /* Link all created objects. Linktype is type of "to" object, f.ex link from browse to combo-box is combo-box link */ THIS-PROCEDURE:CURRENT-WINDOW, /* Link only objects created for current window */ TRUE, /* Replace any existing links */ ""). /* Except these objects – list of handles */ DYNAMIC-FUNCTION("setCompanyHeader",THIS-PROCEDURE:CURRENT-WINDOW)./* The application should supports multiple companies */ DYNAMIC-FUNCTION("setNoResizeY", THIS-PROCEDURE:CURRENT-WINDOW, FRAME {&FRAME-NAME}:HANDLE, "rectTBfile"). DYNAMIC-FUNCTION("setOrgWinSize", THIS-PROCEDURE:CURRENT-WINDOW,200,250,0,250). DYNAMIC-FUNCTION("initTranslation",THIS-PROCEDURE:CURRENT-WINDOW). APPLY "value-changed" TO hBrowse./* Since the query is opened we want to display the first record */ END.

  13. Run the window:

  14. Same window again: ..this time translated, resized and with different BG-color Resize and color settings can be stored pr window pr user

  15. Another window example for generic 3-tier database queries

  16. Run the query The browse is now created based on user-defined buffersand fields

More Related