Power Builder Interview Question and Answers:
16. 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.
17. Under what circumstances will PowerBuilder automatically join tables that you select in 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.
18. Define DataWindow buffers?
PRIMARY BUFFER:
When data is retrieved from the databse by using retrieve() function, it is retrieved into the Primary Buffer and it is the content of this buffer that are displayed in the datawindow.
Powerbuilder always displays the data in datawindow control from the Primary Buffer. Data from other buffers are not visible to the user.
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 don’t match the filterd conditions are moved to the Filtered Buffer.
EDIT CONTROL OR DATA BUFFER
Edit DataWindow Control has one edit control. It contains the current column’s data. When the user modify the data in a column modify data is copied in Edit Control Buffer. The modify data on the screen and the content of the Edit Control are same. But the value in the Primary Buffer has the old data.
19. Define Data Store?
DataStore is a non-visual DataWindow control. DataStore used for Background processing, processing Embeded SQL and Distributed objects.
Background Processing:
Sometimes we use multiple DataWindow control on the screen to display one single report. But those DataWindows are not usable for printing. So we use hidden DataWindow control for printing.
Processing Embedded SQL:
Lot of times we need to use embedded SQL to check whether a particular record is existing in the databse or not. So we can check for the existing record using DataStore.
Distrubuted Objects:
We can use DataStore in the server application when we are developing a distributed application.
20. Which Data Source in the DataWindow painter is itself an object?
Query