Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "- The PUG Challenge - Brynjar Hasle, Chemistry as www.chemistry.no Geir O. Olsen, THInc Consulting as."— 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 AS_lib.p Server: Get data: - gettemptablejoin.p -getfieldlist.p -getfieldvalues.p (FIND) -gettemptable (input.p) -checkcurrentchanged.p Put data: -servertrans.p UI_lib.p z.w y.w x.w Client:

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 criteria Returns fieldlist (f.ex to populate drop-down) -gettemptable.p (input.p, output temp-table handle)

7 Server, put data: - 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.header: -Buffer -Operation -Field list -Opt.val.proc 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 ttObjectLinkttAttributettEvent 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: ; ;.., ;.. 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 buffers and fields


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

Similar presentations


Ads by Google