PB Q and A
PB Q and A
What is PowerBuilder?
Powerbuilder features
SQL SUPPORTS:
Power builder supports SQL and Strored Procedures using DataWindow and
embedded/dynamic SQL and remote procedure calls.
DATA WINDOW:
Data window control is the heart of powerbuilder and is used to display data in a
wide variety of presentation styles.
DATABASE CONNECTIVITY
ODBC DRIVERS:
Supports all popular databases like Sybase, MSSQL, Informix, Oracle and DB2 -
using ODBC 3.0 drivers.
WEB SUPPORT:
Data window plugin : used basically to display datawindow reports on the web.
UNICODE SUPPORT:
Object Level function :Object Level functions are defined for a window,
menu, user object or application object.
Discuss
PassByRef:
When an argument is passed by reference the function can accesses the original
value of the argument and can change it directly.
PassbyReadOnly:
When an argument is passed by read-only we cant change its value but we can
change the value of the argument but we cant assign another object to that
object.
Discuss
Instance:
Intance variable that belongs to an object and associated with an instance of
object. It allows values to be shared between scripts in the same object.
Shared:
Shared variable retain their value when an object is closed and opened again.
Global:
Global variabl can access anywhere in the application. Can access any object in
the application. It has public access level.
Discuss
IDLE
No mouse or keyboard activity happens in a specified number of seconds
SystemError - A serious error occurred during execution.
CLOSE
The user closes the application
ConnectionBegin
In a distributed computing environment, occurs on the server when a client
establishes a connection to the server by calling the ConnectToServer function.
ConnectionEnd
In a distributed computing environment, occurs on the server when a client
disconnects from the server by calling the DisconnectServer function.
Discuss
Global:
Not associated with any objects.
Object Level:
Associated with particular types of windows, menu or user object.
Discuss
Discuss
HALT
HALT CLOSE
CLOSE
Discuss
10. What is HALT? HALT CLOSE? What is the difference between them?
HALT :
Halt statement forces the application to terminate immediately. This is most often used to
shut down the application after a serious error occurred.
HALT CLOSE :
Halt Close does the same thing but triggers the application objects Close event before
terminating.
Discuss
Discuss
Discuss
I. Composite
II. Crosstab
III. Freeform
IV. Graph
V. Grid
VI. Group
VII. Label
VIII. N-up
IX. OLE-2.0
X. Richtext
XI. Tabular
ORIGINAL BUFFER
When user modifies a row in the DataWindow the row in the Primary Buffer
is modified and the original value is copied into the Original Buffer from the
Primary Buffer. Copies data only when the user modify the row for the first
time.
DELTED BUFFER
When the user deletes a row with the DeleteRow() function, rows are
transferred from Primary Buffer to Deleted Buffer.
FILTERED BUFFER
When rows are filtered using the SetFilter() function, the filtered rows are
display in the DataWindow and dont match the filterd conditions are moved
to the Filtered Buffer.
Discuss
Distrubuted Objects:
We can use DataStore in the server application when we are developing a distributed
application.
Discuss
Discuss
19. When powerbuilder retrieves data from the database what status will be occurred?
NOTMODIFIED!
Discuss
Under what circumstances will PowerBuilder automatically join tables that you select in
20.
the Select painter?
If we select tables that have one or more columns with identical names, the Select painter
automatically displays the join, assuming equality between the two columns.
21. What Presentation Styles do you know and when do you use them?
The Tabular presentation style presents data with the data columns going across the page
and headers above each column. As many rows from the database will display at one time
as can fit in the DataWindow object. We can reorganize the Tabular presentation style any
way we want by moving columns and text. Tabular style is often used when we want to
group data.
The Freeform style presents data with the data columns going down the page and labels
next to each column. We can reorganize the default layout any way we want by moving
columns and text. Freeform style is often used for data entry form.
The Grid style presents data in a row-and-column format with grid lines separating rows
and columns. Everything we place in a grid DataWindow object must fit in one cell in the
grid. We cannot move columns and headings around as we can in the Tabular and Freeform
styles. But, unlike the others styles, users can reorder and resize columns with the mouse in
a grid DataWindow object during execution.
The Label style presents data as labels. We choose this style to create mailing labels or
other kinds of labels. If we choose the Label style, we are asked to specify the attributes for
the label in the Specify Label Specification.
The N-Up style presents two or more rows of data next to each other. It is similar to the
Label style. We can have information from several rows in the database across the page, but
the information is not printed on labels. The N-Up presentational style is useful if we have
periodic data; we can set it up so each period repeats in a row..
The Group presentation style provides an easy way to create grouped DW objects, where
rows are divided into groups, each of which can have statistics calculated for it. It generates
a tabular DW that has one group level and some other grouping properties defined. We can
customise the DataWindow in the DataWindow painter workspace.
The Composite presentation style allows us to combine multiple DWs in the same object.
It is handy if we want to print more than one DataWindow on a page.
The Graph presentation style creates a DataWindow object that is only a graph the
underlying data is not displayed. As the data changes, the graph is automatically updated to
reflect the new values. We use a graph to enhance the display of information in the
DataWindow object such as a tabular or freeform DataWindow.
Crosstab processes all the data and presents the summary information that we have defined
for it. We use if we want to analyse data. Crosstab analyses data in a spreadsheet. Instead of
seeing a long series of rows and columns, users can look at a Crosstab that summarises the
data.
OLE 2.0 presentation style using a process called uniform data transfer; info from PB
supported data sources can be sent to an OLE 2.0 server application. The OLE 2-compliant
application uses the PB supplied data to formulate a graph, map, a spreadsheet or the like to
be displayed in the DW.
RichText presentation style using a RichText DW, you can create letters of other
documents by merging info in your DB into a formatted DW. Master word processing
oriented features such as headers, footers and multiple fonts are available in an easy-to-use
format.
Discuss
22. Describe the difference between the grid and tabular presentation styles.
In the Grid presentation style, we cannot move columns and headings around as we can in
the Tabular presentation style but in Grid presentation style users can reorder and resize
columns with the mouse during execution.
Discuss
23. Describe the difference between the labels and N-up presentation styles.
In N-up style, we can also have information from several rows in the database across the
page, but the information is not printed on labels.
Discuss
Discuss
26. How would you define validation rules for the DataWindow object?
We can define validation rules in the DataWindow painter. We can use the SetValidate()
function in a script to set validation rules dynamically (at run time) in a script for DW.
Discuss
Discuss
28. What are the strongest points of using the DataWindow control?
Displaying data.
Entering data.
Scrolling.
Reporting.
Discuss
What is the difference between SQLCA.SQLCode and the value returned by the
29.
DBErrorCode() function?
The DBErrorCode() function (not SQLCA.SQLCode) checks the results of Database
access performed by a DataWindow. We check SQLCA.SQLCode after explicitly issuing
embedded SQL statements, such as Commit.
Discuss
Which feature of the DataWindow painter greatly simplifies the creation of a report having
30.
only one group?
The easiest way to create a report that has a single group is to select the Group presentation
style from the New DataWindow dialog box.
Discuss
Why must you specify the transaction object for a DataWindow control after creating the
33.
DataWindow object?
The Create() function must be followed by SetTransObject() function because Create()
destroys any previous association between the DataWindow and a transaction object. Then,
we can issue a Retrieve().
Discuss
Discuss
Lets say, you share two DW buffers and the primary DW has some DDDW columns. Will
35.
this DDDW be shared automatically as well?
NO. After we have shared 2 DataWindows, we have to share all DropDowns as well. First,
we have to get the reference for the Child DataWindow using GetChild() function and then
do sharing by using ShareData() function.
DataWindowChild dwc_1, dwc_2
dw_1.getchild(employee, dwc_1)
dwc_1.SetTransObject(sqlca)
dwc_1.Retrieve()
dw_2.getchild(employee, dwc_2)
dwc_1.ShareData(dwc_2)
36. How can you update multiple DataBase tables from one DataWindow?
Using Modify() function. When a DataWindow is based on a join of multiple tables, we
can update all of those tables by modifying attributes DataWindow.Table, UpdateTable and
column attributes Update and Key using Modify() function. For example, if the data
initially came from DEPARTMENT and EMPLOYEE tables, and DEPARTMENT table
was specified as an Update Table when we painted the DataWindow, we need to:
Discuss
Discuss
In what attribute of the Transaction object are the database-specific error codes for
38.
Connect/Update/Retrieve stored?
SQLDBCode
Discuss
39. How can you change a Select statement of the DataWindow at runtime?
We can change the select statement by using functions SetSQLSelect() or by changing the
data attributes Table.Select by calling function Modify().
Modify() is preferable because it works faster.
dw_1.Modify(datawindow.Table.Select = Select * from customer)
Discuss
Discuss
43. When Insert statement applied in DataWindow what status will be occurred?
NEWMODIFIED! When a row is inserted into a DataWindow it is initially has a row
status of NEW!, and all columns in a row initially have a column status of
NOTMODIFIED!.
Discuss
44. When Update statement applied in DataWindow what status will be occurred?
DATAMODIFIED!
Discuss
45. What Data Sources do you know and how do you use them?
The Data Source determines how we select the data that will be used in the DW object. If
the data for the DataWindow object is retrieved from a database, we may choose one of the
following Data Sources:
Quick Select is a select from one or multiple tables that are joined through foreign keys
and may include simple selection criteria which appear on the WHERE clause. We can only
choose columns, selection criteria, and sorting. We cannot specify grouping before rows
retrieved, include computed columns, or specify retrieval arguments.
SQL Select is an SQL Select statement from one or more tables in a relational database and
may include selection criteria that appear on any of the possible Select statement clauses
(can include selection criteria (WHERE clause), sorting criteria (ORDER BY clause),
grouping criteria (GROUP BY and HAVING clauses), computed columns, one or more
arguments to be supplied during execution.
Query is a predefined SQL Select statement, which must be previously constructed and
saved as a Query object.
Stored Procedure indicates that the DataWindow will execute a Stored Procedure and
display the data in the first result set. This Data Source only appears if the DBMS to which
PowerBuilder is connected and which supports Stored Procedures. We can specify that the
data for a DataWindow object is retrieved through a stored procedure if our DBMS
supports Stored Procedures.
External is used when the data is not in the database and the DataWindow object will be
populated from a script or data will be imported from a DDE application. If the data is not
in the DB, we select External as the Data Source. This includes the following situations:
If the DataWindow object is populated from a script
If data is imported from a DDE application
If data is imported from an external file, such as a tab-separated text file (.TXT file) or a
dBASE file (.DBF file).
Externalindicates that we have coded a script that supplies the DataWindow object with its
data. We use this Data Source when the data is in a .TXT or .DBF file or obtained through
DDE. We may also use it when we plan to obtain the data by embedding our own SQL
Select statement in a script. With this Data Source the DataWindow object does not issue its
own SQL statement. We specify the data columns and their types so that PB can build an
appropriate
DataWindow object to hold the data. These columns make up the result set. In a script, we
will need to tell PowerBuilder how to get data into the DataWindow in our application.
Typically, we will import data during execution using a PowerScript Import function (such
as ImportFile() and ImportString() or do some data manipulation and use the SetItem()
function to populate the DataWindow.
46. What functions do you use to change the row status?
dw_1.SetUpdateStatus()
dw_1.SetItemStatus()
dw_1.GetUpdateStatus()
dw_1.GetItemStatus()
Discuss
47. How do you stop the user from editing data that is displayed in a field of a DataWindow?
Change the tab value of the field to zero in the DataWindow painter.
Discuss
In order to sort the contents of a DataWindow, two commands must be used. What are they
48.
and what does each do?
SetSort() and Sort().
SetSort() defines the sort criteria (primary, secondary sort files - ascending or descending
order, etc.).
Sort() performs the actual sort.
Discuss
What is the difference between computed columns and computed fields in a DataWindow
49.
object?
Computed columns are created as a result of a SQL query on the server side.
Computed fieldsas a result of internal processing by DataWindow on the client side.
Discuss
When you implement incremental search, there is no Current row, so how do you highlight
50.
the row you are looking for?
SelectRow()
ll_row = Find()
if ll_row > 0 then SelectRow (ll_row)
What are Extended column attributes? How can you change them dynamically?
Its DataWindow object property (Expressions) which we can change dynamically using
Modify() function.
Discuss
Specifies whether PowerBuilder uses the code table for the column to validate data.
Values are Boolean: TrueUses code table to validate data; FalseDoes not use code
table to validate data.
Each row in the Code Table is a pair of corresponding values: a display value that
user sees and data values-those that are saved in the database.
Discuss
Discuss
55. How do you trap errors from the DataBase in the DataWindow?
Write some code in the DBError Event
For example:
IF SQLCA.SQLCode <> 0 THEN
MessageBox()
return 1
END IF
What two types of computed columns are allowed in a DataWindow?
Discuss
Discuss
58. . How many tables can be updated at the same time in a DataWindow?
One is updated by default. If we want to update multiple tables from DW, we have to write
a script for this using MODIFY()
Discuss
Discuss
Discuss
Discuss
58. . How many tables can be updated at the same time in a DataWindow?
One is updated by default. If we want to update multiple tables from DW, we have to write
a script for this using MODIFY()
Discuss
Discuss
When we use SETTRANS(), the DW control uses its own Transaction object and
automatically performs connect, disconnect, commit and rollback. The
SetTransObject() tells the DW control to share the transaction object with other DW
controls. We have to control the database processing and we are responsible for managing
database transactions. Application performance is better when we use SetTransObject().
Discuss
If the source for a DW is a stored procedure and this stored procedure has parameters,
62.
where do we have to pass these parameters?
In the RETRIEVE().
Discuss
Discuss
Discuss
Discuss
Discuss
68. How PowerBuilder search for a function?
Bottom - to -Top.
Discuss
Discuss
Discuss
Return value is .
Return 1 if succeeds and -1 if its fails.
Discuss
Discuss
Discuss
74. What STATUS occurs When a row is copied from another DataWindow?
NewModified!
Discuss
75. What are the buffers will maintain a DataWindow if set to ReadOnly?
All the four buffers. Primary!, Original!, Delete!, Filter!.
Explain Computed Column
Computed clumn is a column that we define as a part of the SELECT
statement. This values are calculated by the database and send to the
PowerBuilder.
Discuss
Discuss
78. How many DataWindow can share the data from a DataWindow?
There is no limitation.
Discuss
Discuss
TriggerEvent() function executes synchronously, the next command after this command
will not be executed untill thios command is executed completly.
Return type is :
Return 1 Successfully Executed.
Return -1 Invalid.
Discuss
Discuss
Discuss
Discuss
84. How to execute the ancestor events script from the decendents event?
We can use CALL SUPER::EVENT_NAME
Discuss
85. Can we have Global and Local/Instance variable with the same name?
YES.
This.var_1 = 100 //Instance Variable.
var_1 = 100 //Local Variable.
::var_1 = 100 //Global Variable.
Explain CloseQuery event?
PowerBuilder triggers CloseQuery event before it triggers Close event.
If CloseQuery events script not executed successfully close event will
nerver trigger.
Discuss
Discuss
Discuss
SETTRANSOBJECT()
SetTransObject tells the DataWindow to use specified transaciton object.
SETTRANS()
The DataWindow control connects and disconnects after each Retrieve or Update function
while using SetTrans
When we use SetTrans we cant update multiple DataWindow object.
Discuss
Discuss
Discuss
CHILD
A window that is dependent on a main window and can only exist within the
main(PARENT) window. If minimize the main window as well as the child window is
minimizsed. A child window cannot beyond the parent window.
MDI
MDI window allows to open multiple window as sheet inside it. When a window inside the
MDI window it minimize and maximized wheet icon is displayed at the bottom of the MDI
window.
MDIHELP
MDIHELP window has additional feature of a status bar at the bottom of the MDIHELP
window. This status bar used to display help text like run time.
POPUP
POPUP window depends on it parent window. POPUP window will behave like a main
window. IT the parent window is minimized POPUP window will be hidden.
RESPONSE
RESPONSE window equalent of a window dialog box. When a response window is opened
from another window the response window cant minimize and maximize untill the user
gives response to the window cant get another window.
Discuss
MDI Frame
Frame
Client Area
Sheets
Discuss
95.
How to open a window with a parameter?
Discuss
Discuss
100. How many .PBDs can you have for one application?
As many as we need and depending on available memory.
Discuss
101. How many .PBRs can you have for one application?
One
Discuss
Discuss
DropDown
Cascading
Pop-up
Discuss
104. What is Regenerate option in the Library painter? When is it most useful?
It compiles all codes of an object(s). Regeneration is important during the development of
our PB application. Regeneration is useful :
When we upgrade to a new version of PB, the new version should regenerate all its
source code to update it;
When we make a change to an ancestor window that has many descendants, the
changes can be immediately rippled throughout all child window through
regeneration. Regenerating could be called recompiling. When you regenerate an
entry, PowerBuilder recompiles the source form stored in the library and replaces
the existing compiled form with the recompiled form.
Discuss
Discuss
Discuss
Discuss
109. How can you dynamically place an User Object on the window?
By using functions : OpenUserObject( ), OpenUserObjectWithParm( )
Discuss
Discuss