Where Clause for Update/Delete
Key Columns
This option is commonly used for single-user applications. It’s also used when working with “many-to-many” tables where the primary key consists of all the columns in the table
Key and Updateable Columns
This method provides maximum consistency
Key and Modified Columns
This option provides maximum concurrency
You should check the data model to make sure the update does not violate the business rules of the database. The value you are changing may depend on the value of another column that may have been changed.
Graphs
What is the difference between Value, Category and Series?
- Value is the dependent variables (y axis)
- Category is the by component (x axis)
- Series is the third component in a 3D graph (z axis)
How do I use the ObjectAtPointer( ) function?
The ObjectAtPointer( ) function will allow the user to drill down on clicked graph data. It has three arguments: GraphObject, SeriesNumber, and DataPoint.
The following script is for a datawindow control’s clicked event. It identifies what graph object was clicked, if it is a category or value, it retireves the data in a second DataWindow based o the passed argument.
GrObjectType ClickedObject Long ll_dept_num String ls_deptnum Integer li_ret, li_series, li_category ClickedObject = this.ObjectAtPointer(‘gr_1’, li_series, li_category) //If the userr clicked data or category, find out which one and retrieve second dw with argument IF ClickedObject = TypeData! OR ClickedObject = TypeCategory! THEN Ls_deptnum = this.CategoryName(‘gr_1’, li_category) Ll_deptnum = long(ls_deptnum) Dw_detail.title = “Employees in dept “ + ls_deptnum Dw_detail.Retrieve(ll_deptnum) Dw_detail.show( ) ELSE MessageBox(parent.title, “Click a department to see employee names”) END IF
Grid Style
PowerScript
You can prevent the user from moving columns in a grid
Dw_1.Object.DataWindow.Grid.ColumnMove = ‘no’
Dw_1.object.DataWindow.Grid.lines = 2 // 0 – always, 1 - never, 2 – display only, 3 print only
How do I get rid of the grid lines?
Starting with version 5, PB allows you to turn off the lines on a grid datawindow. To do this from the datawindow painter, set the datawindow property (click on the dw background, not on a column of text field) GRID and DISPLAY on the GENERAL tab.
To change the lines at run time, use the following
Nested Report
What is a nested report?
A report can nest another report as an object within it. This can be useful for representing master/detail information. For each master row, a separate retrieve is done for each detail row. So a report with 20 master rows involves 21 retrieves.
Detail rows can relate the nested report to the base report via retrieval arguments or retrieval criteria.
To access nested data use something like this:
Dw_1.object.base[1].object.nest[1]
The GetChild function will work for composite reports but not for nested ones.
The big pain about nested reports is that they have no current row, so a GetRow() will always return 0. So getting information can not be pinpointed with a mouse click. The row in the clicked event will refer to the container’s row, not the nested report’s row.
How do I determine if a datawindow contains nested Reports, i.e. is a Base Report (container datawindow)?
dw_control.Object.DataWindow.Nested
or
“DataWindow.Nested”
Which presentation styles are used for reporting only?
|
Reporting Only |
Reporting and Updating |
|
Composite |
Freeform |
|
Crosstab |
Grid |
|
Graph |
Group |
|
Label |
Tabular |
|
OLE 2.0 |
RichText |
|
|
N-up |
SQL Painter
How can I use Retrieval Arguments to make my where clause more flexible?
Here is a solution I came up with to avoid the need to dynamically modify the Where Clause, or creating multiple datawindows with slightly different SQL. The JOB_QUEUE_RULE table has IDs which must be a positive number ( a good place for a check constraint in the table’s DDL). If you want to see all the rules, set the retrieval argument to 0, otherwise set the ret arg to the ID you want to see.
SELECT R.ID,
R.DESCRPTION
FROM dbo.JOB_QUEUE_RULE R
WHERE ((R.ID = :ra_id) OR (:ra_id = 0 ))
How do I limit the number of tables to those with a certain prefix?
There exists a parameter to limit the tables you view in the database painter. Here’s the language you need.
- Click the DB profile tool bar button
- Select the profile you want and click EDIT (this action displays the DATABASE PROFILE SETUP dialogue)
- Select the SYSTEM tab
- Go to the TABLE CRITERIA section and type ,W11559,”TABLE” (or replace W11559 with whichever account you want)
- Click OK (this action returns you to the DATABASE PROFILES dialogue)
- Click CONNECT
- Help can be found under TABLECRITERIA (one word)
How can I use Dual (Oracle) to populate my initial search screen?
SELECT '' as secretary_code,
'' as LOG_SEQ_NO,
'' as governor_log_no,
'' as SUBJECT_DESC,
' as BUREAU_REGION_CODE,
to_date('' ) as FR_received_on_date,
to_date('' ) as TO_received_on_date,
to_date('' ) as FR_DUE_DATE,
to_date('' ) as TO_DUE_DATE,
to_date('' ) as FR_letter_out_date,
to_date('' ) as TO_letter_out_date,
to_date(to_date(to_char(add_months(sysdate,-12),'mm/dd/yyyy' ), 'mm/dd/yyyy' )) as FR_date,
to_date(to_char(sysdate,'mm/dd/yyyy' ),'mm/dd/yyyy' ) as TO_date,
'' as leg_cust_last_name,
'' as leg_cust_first_name,
to_date('' ) as fr_letter_date,
to_date('' ) as to_letter_date
FROMDUAL
Magic where clause for datawindow receiving a date retrieval argument
WHERE “WM_HUNTERS_CHOICE_APPLICANT”.”DOB” = to_date(:as_dob, ‘mm/dd/yyyy’ )
When I try to switch from Syntax mode to Graphic mode, PowerBuilder gives me a message saying that it can’t.
Tables associated with your SQL can not be accessed from your current database profile. Switch to a database profile with the correct server and system login ID and password.
-
Archives
- August 2009 (2)
- May 2009 (1)
- March 2009 (1)
- January 2009 (2)
- December 2008 (1)
- November 2008 (2)
- September 2008 (1)
- August 2008 (1)
- July 2008 (24)
- June 2008 (22)
- May 2008 (69)
- April 2008 (25)
-
Categories
-
RSS
Entries RSS
Comments RSS