1 / 27

IA 345 What Every PowerBuilder Developer Needs to Know about DropDown DataWindows

IA 345 What Every PowerBuilder Developer Needs to Know about DropDown DataWindows. Tom Bartha Principal Consultant PricewaterhouseCoopers tom.bartha@us.pwcglobal.com. To explore what is inherent in a DDDW versus what a PowerBuilder developer has to provide.

chico
Download Presentation

IA 345 What Every PowerBuilder Developer Needs to Know about DropDown DataWindows

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. IA 345What Every PowerBuilder DeveloperNeeds to Know aboutDropDown DataWindows • Tom Bartha • Principal Consultant • PricewaterhouseCoopers • tom.bartha@us.pwcglobal.com

  2. To explore what is inherent in a DDDW versus what a PowerBuilder developer has to provide. To demonstrate basic and developer provided functionality. To provide a full text version of this presentation. All code examples will be available on the Presenters Web Page: www.sybase.com/techwave2000/presenters Objectives of this Session

  3. Regardless of ever increasing computing resources at an ever decreasing cost, we need to store some data in codified manner. To display full data value corresponding to coded information we often resort to drop-down lists. Drop-down lists representing constantly changing data needs to be dynamically populated. Prior to PowerBuilder 3.0 this required work. Before DropDown DataWindows

  4. In order to populate a ddlb with data from a table, we had to Declare a cursor Open the cursor Fetch the data into the code table of the ddlb one at a time In the open event of the window (parent of ddlb) you would have the following script: Before PowerBuilder 3.0

  5. integer li_counter string Is_state_id, Is_state_name DECLARE state_cursor CURSOR FOR Select state_id, state_name From states_table Using SQLCA; OPEN state_cursor (continued) Code Example for Cursor

  6. Do WHILE sqlca.sqlcode = 0 Fetch state_cursor INTO :Is_state_id, :Is_state_name; IF sqlca.sqlcode = 0 THEN ddlb_data.SetValue("state", li_counter, Is_state_name + "‑t" & + string(Is_state_id)) END IF li_counter++ LOOP Close state_cursor Code Example for Cursor (continued)

  7. Definitions in Help and the On-line Books: “A DataWindowChild object is a nested report or a DropDown DataWindow within a DataWindow object. For example, a DataWindow object that populates a column having the DropDownDataWindow edit style is a DataWindowChild object.” DropDown DataWindow Definitions

  8. Definitions in Help and the On-line Books: “A DataWindowChild object is used for accessing DataWindow objects independently from DataWindow functionality, and it inherits from the system Structure object because it needs storage and autoinstantiation.” “A DataWindowChild object has no properties and no events, but it does have functions.” DropDown DataWindow Definitions (continued)

  9. Use of DropDown DataWindows • 1. Data Entry

  10. Use of DropDown DataWindows • 2. Data Display and Reports

  11. Use of DropDown DataWindows • 3. Search DataWindows

  12. Define a datawindow object “Nest” this datawindow object inside a parent datawindow: Build another datawindow as parent OR Use an exisiting multi-column datawindow as parent Creating a DropDown DataWindow

  13. Option A Create a new datawindow object using the same table as the one the dddw is defined on. Option B Create a new free-form external datawindow object. Option C Use recursion, namely, place the dddw inside itself. Exclusive DropDown DataWindows

  14. Exclusive DropDown DataWindows (continued) Demonstration

  15. Default Process Parent Managing the Child Multiple dddw’s in Parent Frequently Used dddw Result Sets Infrequently Used dddw Result Sets Populating DropDown DataWindows

  16. DDDW Retrieval Arguments • DDDW may or may not have retrieval arguments • If not programmed you get the retrieval argument dialog window

  17. PowerBuilder will attempt to Retrieve a DDDW if the DDDW has no rows in the Primary Buffer Overriding the Default Process Preload a blank row Retrieve the DDDW before the main DW Using Retrieval Arguments Retrieve dddw when window opens Retrieve dddw when something changes DDDW’s with Retrieval Arguments

  18. Storing Data in a DataWindow Object Rows Data in DW Painter Data are stored with the DW Data are automatically displayed in the DataWindow when it is instantiated

  19. A child datawindow is any datawindow which is nested inside another datawindow and, therefore, dependent on its parent. The child does not have a name accessible at the window level. We must define a variable of type datawindowchild and trap the child’s handle. Use GetChild function: dw_control.GetChild(col_name, child_handle) Child DataWindows

  20. A child datawindow works in very close conjunction with its parent: The child picks up the parent’s transaction object. The child will retrieve its result set from the database when the parent is retrieved. To override these defaults we must remember that as long as the child datawindow has a valid result set, no new result set will be retrieved by default. Overriding the Default Process

  21. Script in the open event of the window: integer li_return datawindowchild ldwx_dept dw_parent.SetTransObject(sqlca) // Obtain the handle of the dddw in the department column li_return = dw_parent.GetChild(“dept_id”, ldwc_dept) IF li_return = 1 THEN ldwc_dept.SetTransObject(sqlca) ldwc_dept.InsertRow(0) dw_parent.Retrieve( ) Overriding the Default Process (continued)

  22. ELSE MessageBox(“DataWindow Error”, “Unable to obtain dddw handle.”) END IF Overriding the Default Process (continued)

  23. Create a non-visual object. Define an instance array of DataStores. Add a method to share data. Call the method to share from the DataWindows that need caching. After sharing dddw’s retrieve your DataWindows in a normal way. Sharing Hidden DDDW’s

  24. Problem: On the parent datawindow there are a number of dddw columns, each of which contains a large number of rows. Not all the result sets are needed at the same time or even in one user session. Want to avoid the retrieval time, unless result set is needed. Solution: Populate the dddw’s only if the user clicks on the corresponding columns. (see demonstration) Infrequently Used DDDW Result Sets

  25. Synchronized DDDW’s Retrieve Arguments vs Filtering Adding data elements to a dddw on the fly Cascading dddw’s Code Examples

  26. Slide title, may be two lines, Arial Black, 32 pt. Color Palette Arrow Style

  27. 100 90 80 70 60 50 40 30 20 10 0 1st Qtr 2nd Qtr 3rd Qtr 4th Qtr Slide title, may be two lines, Arial Black, 32 pt.

More Related