PowerBuilder FAQ: DataWindow & SQL
PowerBuilder FAQ: DataWindow & SQL
Sr.N Question
o.
1 How can you generate runtime DataWindow object.
Ans Using syntaxfromsql function to get sqlsyntaxt for the passed sql string and then calling
function create
SyntaxFromSQL:
Create:
dwcontrol.Create ( syntax {, errorbuffer } )
Argument Description
dwcontrol The name of the DataWindow control or DataStore in which PowerBuilder
will create the new DataWindow object
syntax A string whose value is the DataWindow source code that will be used to create the
DataWindow object
errorbuffer (optional) The name of a string that will hold any error messages that occur. If
you do not specify an error buffer, a message box will display the error messages
Return value
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is NULL,
Create returns NULL.
2 How can you open a userobject or tabcontrol in a window?
Ans tabcontrolname.OpenTab ( userobjectvar, index )
Argument Description
tabcontrolname The name of the Tab control in which you want to open the user object as a tab
page
userobjectvar The name of the custom visual user object you want to open as a tab page. You
can specify a custom visual user object defined in the User Object painter (which is a user
object data type) or a variable of the desired user object data type. Open places a reference to
the opened custom visual user object in userobjectvar index. The number of the tab before
which you want to insert the new tab. If index is 0 or greater than the number of tabs, the tab
page is inserted at the end
Return value
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is NULL,
OpenTab returns NULL.
windowname.OpenUserObject ( userobjectvar {, x, y } )
Argument Description
windowname The name of the window in which you want to open the user object
userobjectvar The name of the user object you want to display. You can specify a user object
defined in the User Object painter (which is a user object data type) or a variable of the desired
user object data type. Open places a reference to the opened user object in userobjectvar
x (optional) The x coordinate in PowerBuilder units of the user object within the window's
frame. The default is 0
y (optional) The y coordinate in PowerBuilder units of the user object within the window's
frame. The default is 0
3 What is garbage collection and what are the functions to set and get garbage time limit.
Ans What garbage collection does
The PowerBuilder garbage collection mechanism checks memory automatically for
unreferenced and orphaned objects and removes any it finds, thus taking care of most memory
leaks. You can use garbage collection to destroy objects instead of explicitly destroying them
using the DESTROY statement. This lets you avoid execution-time errors that occur when you
destroy an object that was being used by another process or had been passed by reference to a
posted event or function.
There are a few objects that are prevented from being garbage collected:
¨ Visual objects Any object that is visible on your sceen is not garbage collected because
when the object is created and displayed on your screen an internal reference is added to the
object. When any visual object is closed it is explicitly destroyed.
¨ Timing objects Any Timing object that is currently running is not garbage collected
because the Start function for a Timing object adds an internal reference. The Stop function
removes the reference.
¨ Shared objects Registered shared objects are not garbage collected because the
SharedObjectRegister function adds an internal reference. SharedObjectUnregister removes the
internal reference.
Garbage collection occurs automatically in PowerBuilder, but you can use the functions
GarbageCollect, GarbageCollectGetTimeLimit, and GarbageCollectSetTimeLimit to force
immediate garbage collection or to change the interval between reference count checks. By
setting the interval between garbage collection passes to a very large number, you can
effectively turn off garbage collection.
4 Give some example of function overloading.
Ans Messagebox(),Open(),opentab(),openuserobject() etc. all these functions are overloadded
because there are more than one function with same name in same class with different number
of parameter
5 Can you open a response window with OpenSheet function?
Ans Yes, we can open a response window with opensheet function but then that window will not
work as response.It will work as a main window.So Opening response windows Do not use the
OpenSheet function to open a response window
6 Can you open more that one response window at the same time? And why?
Ans No,you can not open multiple response windows at the same time because when you open one
response window It expect some input from user then only it proceed further.
7 You can inherit the user object and window so which one is preferable and why.
Ans User object is preferable because it takes less memory because in memory structure there are
two pool class pool and instance pool. Class pool maintain the class like window ,userobject
and instance pool which keeps all instances of the objects. To run a application atleast one
window should be open
So always there will be one window class in class pool. But in case of there is no need to keep
any user object in class pool when we do not need it.
8 What is the return value of describe and modify function?
Ans dwcontrol.Describe ( propertylist )
Argument Description
dwcontrol The name of the DataWindow control, DataStore, or child DataWindow for
which you want information about the structure
propertylist A string whose value is a blank-separated list of properties or Evaluate
functions. For a list of valid properties, see the DataWindow Reference
Return value
String. Returns a string that includes a value for each property or Evaluate function. A newline
character (~n) separates the value of each item in propertylist.
If the property list contains an invalid item, Describe returns an exclamation point (!) for that
item and ignores the rest of the property list. Describe returns a question mark (?) if there is no
value for a property.
When the value of a property contains a question mark (?), the value is returned in quotes so
that you can distinguish between it and a property with no value.
9 Can you copy data from one datawindow to other? And how.
Ans Yes, we can copy data from one datawindow to other. To do so we can use functions
rowscopy.
dwcontrol.RowsCopy (startrow, endrow, copybuffer, targetdw, beforerow, targetbuffer )
Argument Description
dwcontrol The name of a DataWindow control, DataStore, or child DataWindow from
which you want to copy rows
startrow A long whose value is the number of the first row you want to copy
endrow A long whose value is the number of the last row you want to copy
copybuffer A value of the dwBuffer enumerated data type specifying the buffer from
which you want to copy the rows:¨ Primary!¨ Delete!¨ Filter!
targetdw The name of the DataWindow control or DataStore object to which you want
to copy the rows. Targetdw can be the same DataWindow (or DataStore) or another
DataWindow (or DataStore)
beforerow A long specifying the number of the row before which you want to insert the
copied rows. To insert after the last row, use any value that is greater than the number of
existing rows
targetbuffer A value of the dwBuffer enumerated data type specifying the target buffer for
the copied rows. Values are:¨ Primary!¨ Delete!¨ Filter!
Return value
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is NULL,
RowsCopy returns NULL.
Usage
When you use the RowsCopy function, the status of the rows that are copied to the primary
buffer is NewModified!. If you issue an update request, PowerBuilder will send SQL INSERT
statements to the DBMS for the new rows.
When you use RowsCopy, data is not automatically retrieved for drop-down DataWindows in
the target DataWindow or DataStore, as it is when you call InsertRow. You must explicitly call
Retrieve for child DataWindows in the target.
¨ Making copies of one or more rows so that the users can create new rows based on
existing data
¨ Printing a range of rows by copying selected rows to another DataWindow and
printing the second DataWindow
Buffer manipulation and query mode A DataWindow cannot be in query mode when you call
the RowsCopy function.
10 Can you copy data from one buffer to other within the same DataWindow and how?
Ans Yes, we can copy data from one datawindow to other. To do so we can use functions
RowsCopy.
dwcontrol.RowsCopy (startrow, endrow, copybuffer, targetdw, beforerow, targetbuffer )
Argument Description
dwcontrol The name of a DataWindow control, DataStore, or child DataWindow from
which you want to copy rows
startrow A long whose value is the number of the first row you want to copy
endrow A long whose value is the number of the last row you want to copy
copybuffer A value of the dwBuffer enumerated data type specifying the buffer from
which you want to copy the rows:¨ Primary!¨ Delete!¨ Filter!
targetdw The name of the DataWindow control or DataStore object to which you want
to copy the rows. Targetdw can be the same DataWindow (or DataStore) or another
DataWindow (or DataStore)
beforerow A long specifying the number of the row before which you want to insert the
copied rows. To insert after the last row, use any value that is greater than the number of
existing rows
targetbuffer A value of the dwBuffer enumerated data type specifying the target buffer for
the copied rows. Values are:¨ Primary!¨ Delete!¨ Filter!
Return value
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is NULL,
RowsCopy returns NULL.
Usage
When you use the RowsCopy function, the status of the rows that are copied to the primary
buffer is NewModified!. If you issue an update request, PowerBuilder will send SQL INSERT
statements to the DBMS for the new rows.
When you use RowsCopy, data is not automatically retrieved for drop-down DataWindows in
the target DataWindow or DataStore, as it is when you call InsertRow. You must explicitly call
Retrieve for child DataWindows in the target.
¨ Making copies of one or more rows so that the users can create new rows based on
existing data
¨ Printing a range of rows by copying selected rows to another DataWindow and
printing the second DataWindow
Buffer manipulation and query mode A DataWindow cannot be in query mode when you call
the Rowcopy function.
11 How can you move record from one datawindow to other and one buffer to other?
Ans Yes you can do so using rowsmove function.
dwcontrol.RowsMove ( startrow, endrow, movebuffer, targetdw, beforerow, targetbuffer )
Argument Description
dwcontrol The name of a DataWindow control, DataStore, or child DataWindow from
which you want to move rows
startrow A long whose value is the number of the first row you want to move
endrow A long whose value is the number of the last row you want to move
movebuffer A value of the dwBuffer enumerated data type specifying the buffer from
which you want to move the rows. Values are: ¨ Primary! ¨ Delete! ¨ Filter!
targetdw The name of the DataWindow control or DataStore to which you want to move
the rows. Targetdw can be the same DataWindow control (or DataStore) or a different
DataWindow control (or DataStore), but it cannot be a child DataWindow
beforerow A long specifying the number of the row before which you want to insert the
moved rows. To insert after the last row, use any value that is greater than the number of
existing rows
targetbuffer A value of the dwBuffer enumerated data type specifying the target buffer for
the moved rows. Values are:¨ Primary!¨ Delete!¨ Filter!
Return value
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is NULL,
RowsMove returns NULL.
Usage
When you use RowsMove, the rows have the status NewModified! in the target DataWindow.
If you move rows between buffers in a single DataWindow control or DataStore, PowerBuilder
retains knowledge of where the rows came from and their status is changed accordingly. For
example, if you move unmodified rows from the primary buffer to the delete buffer, they are
marked for deletion. If you move the rows back to the primary buffer, their status returns to
NotModified!. Note, however, that if you move rows from one DataWindow control (or
DataStore) to another and back again, the rows' status is NewModified! because they came
from a different DataWindow.
When you use RowsMove, data is not automatically retrieved for drop-down DataWindows in
the target DataWindow, as it is when you call InsertRow. You must explicitly call Retrieve for
child DataWindows in the target.
¨ Moving several rows from the primary buffer to the delete buffer, instead of deleting
them one at a time
¨ Moving rows from the delete buffer to the primary buffer, to implement an Undo
capability in your application
Buffer manipulation and query mode A DataWindow cannot be in query mode when you call
the RowsMove function.
12 How can you delete or filter the records with out sending them to buffer.
Ans We can do so by using rowsdiscard function.
dwcontrol RowsDiscard (startrow, endrow, buffer )
Argument Description
dwcontrol The name of a DataWindow control or child DataWindow from which you
want to discard rows
startrow A long whose value is the number of the first row you want to discard
endrow A long whose value is the number of the last row you want to discard
buffer A value of the dwBuffer enumerated data type specifying the buffer containing the
rows to be discarded. Values are: ¨ Primary! ¨ Delete! ¨ Filter!
Return value
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is NULL,
RowsDiscard returns NULL.
Usage
Use RowsDiscard when your application is finished with some of the rows in a DataWindow
control and you don't want an update to affect the rows in the database. For example, you can
discard rows in the delete buffer, which prevents the rows from being deleted when you call
Update.
To clear all the rows from a DataWindow control, use Reset.
13 If the datawindow update property is false and you applied a delete function to some records
Ans what will happen?
In this case deleted rows will not go to the delete buffer. This time delete work as RowsDiscard
function
14 How can you make sharing of datawindow off?
Ans You can do so using function sharedataoff.
dwcontrol.ShareDataOff ( )
Argument Description
dwcontrol The name of the DataWindow control, DataStore, or child DataWindow for
which you want to turn off data sharing
Return value
Integer. Returns 1 if it succeeds and -1 if an error occurs. If dwcontrol is NULL, ShareDataOff
returns NULL.
Usage
Two or more DataWindow controls (or DataStores) can share data. See ShareData for more
information about shared data buffers and primary and secondary DataWindows.
When you call ShareDataOff for a secondary DataWindow, that control no longer contains
data, but the primary DataWindow and other secondary controls are not affected. When you
call ShareDataOff for the primary DataWindow, all secondary DataWindows are disconnected
and no longer contain data.
15 What are the restrictions to share data between to datawindow?
Ans dwprimary.ShareData ( dwsecondary )
Argument Description
dwprimary The name of the primary DataWindow. The primary DataWindow is the owner
of the data. When you destroy this DataWindow, the data disappears. Dwprimary can be a
child DataWindow
dwsecondary The name of the secondary DataWindow; which is the control dwprimary will
share the data with. The secondary DataWindow cannot be a Crosstab DataWindow. It can be a
child DataWindow
Return value
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is NULL,
ShareData returns NULL.
Usage
The columns must be the same for the DataWindow objects in the primary and secondary
DataWindow controls, but the SELECT statements may be different. For example, you could
share data between DataWindow objects with these SELECT statements:
WHERE clause in secondary has no effect. The WHERE clause in the DataWindow object in
the secondary DataWindow control has no effect on the number of rows returned. The number
of rows returned to both DataWindow controls is determined by the WHERE clause in the
primary DataWindow object.
You could also share data with a DataWindow object that has a script data source and a column
defined to be like the dept_id column.
To share data between a primary DataWindow and more than one secondary DataWindow
control, call ShareData for each secondary DataWindow control.
To turn off sharing in a primary or secondary DataWindow, call the ShareDataOff function.
When sharing is turned off for the primary DataWindow, the secondary DataWindows are
disconnected and the data disappears. However, turning off sharing for a secondary
DataWindow does not affect the data in the primary DataWindow or other secondary
DataWindows.
When you call functions in either the primary or secondary DataWindow that change the data,
PowerBuilder applies them to the primary DataWindow control and all secondary
DataWindow controls are affected. For example, when you call any of the following functions
for a secondary DataWindow control, PowerBuilder applies it to the primary DataWindow.
Therefore, all messages normally associated with the function go to the primary DataWindow
control. Such functions include:
DeleteRow
Filter
GetSQLSelect
ImportFile
ImportString
ImportClipboard
InsertRow
ReselectRow
Reset
Retrieve
SetFilter
SetSort
SetSQLSelect
Sort
Update
Query mode and secondary DataWindows When you are sharing data, you cannot turn on
query mode for a secondary DataWindow. Trying to set the QueryMode or QuerySort
properties results in an error.
To share data between a DataStore or DataWindow and a RichTextEdit control, use the
DataSource function.
Distributed applications You cannot share data between a DataWindow control in a client
application and a DataStore in a server application.
Dynamic SQL syntax format 3: Use this format to execute a SQL statement that produces a
result set in which the input parameters and result set columns are known at compile time.
Syntax
For information about global, instance, shared, and local scope, see "Where to declare variables
".
Dynamic SQL syntax format 4: Use this format to execute a SQL statement that produces a
result set in which the number of input parameters, or the number of result-set columns, or both
are unknown at compile time.
Syntax
DECLARE Cursor | Procedure DYNAMIC CURSOR | PROCEDURE FOR
DynamicStagingArea ;
For information about global, instance, shared, and local scope, see "Where to declare variables
".
Accessing attribute information When a statement is described into a
DynamicDescriptionArea, this information is available to you in the attributes of that
DynamicDescriptionArea variable:
Information Attribute
Number of input parameters NumInputs
Array of input parameter types InParmType
Number of output parameters NumOutputs
Array of output parameter types OutParmType
Setting and accessing parameter values The array of input parameter values and the array of
output parameter values are also available. You can use the SetDynamicParm function to set
the values of an input parameter and the following functions to obtain the value of an output
parameter:
GetDynamicDate
GetDynamicDateTime
GetDynamicNumber
GetDynamicString
GetDynamicTime
Parameter values The following enumerated data types are the valid values for the input and
output parameter types:
TypeBoolean!
TypeDate!
TypeDateTime!
TypeDecimal!
TypeDouble!
TypeInteger!
TypeLong!
TypeReal!
TypeString!
TypeTime!
TypeUInt!
TypeULong!
TypeUnknown!
Input parameters You can set the type and value of each input parameter found in the
PREPARE statement. PowerBuilder populates the SQLDA attribute NumInputs when the
DESCRIBE is executed. You can use this value with the SetDynamicParm function to set the
type and value of a specific input parameter. The input parameters are optional; but if you use
them, you should fill in all the values before executing the OPEN or EXECUTE statement.
Output parameters You can access the type and value of each output parameter found in the
PREPARE statement. If the database supports output parameter description, PowerBuilder
populates the SQLDA attribute NumOutputs when the DESCRIBE is executed. If the database
does not support output parameter description, PowerBuilder populates the SQLDA attribute
NumOutputs when the FETCH statement is executed.
You can use the number of output parameters in the NumOutputs attribute in functions to
obtain the type of a specific parameter from the output parameter type array in the
OutParmType attribute. When you have the type, you can call the appropriate function after the
FETCH statement to retrieve the output value.
17 What is the SQLSA
Ans DynamicStagingArea is a PowerBuilder data type. PowerBuilder uses a variable of this type to
store information for use in subsequent statements.
The DynamicStagingArea is the only connection between the execution of a statement and a
transaction object and is used internally by PowerBuilder; you cannot access information in the
DynamicStagingArea.
PowerBuilder provides a global DynamicStagingArea variable named SQLSA that you can use
when you need a DynamicStagingArea variable.
If necessary, you can declare and create additional object variables of the type
DynamicStagingArea. These statements declare and create the variable, which must be done
before referring to it in a dynamic SQL statement:
DynamicStagingArea dsa_stage1
PowerBuilder provides a global DynamicDescriptionArea named SQLDA that you can use
when you need a DynamicDescriptionArea variable.
If necessary, you can declare and create additional object variables of the type
DynamicDescriptionArea. These statements declare and create the variable, which must be
done before referring to it in a dynamic SQL statement:
DynamicDescriptionArea dda_desc1
-1 startrow value supplied is greater than the number of rows in the string
-3 Invalid argument
-4 Invalid input
-9 PowerBuilder or the user canceled import because data failed validation
Usage
The format of the string is the same as if the data came from an ASCII file. The string must be
formatted in tab-delimited columns and each line must end with a carriage return and a newline
character (~r~n). If the string has four tab-delimited columns, one line might look like:
For a DataWindow control or DataStore, the string should consist of rows of data. If the data
includes column headings or row labels, set the startrow and startcolumn arguments to skip
them. The data types and order of the DataWindow object's columns must match the columns
of data in the string.
The startcolumn and endcolumn arguments control the number of columns imported from the
string and the number of columns in the DataWindow that are affected. The dwstartcolumn
argument specifies the first DataWindow column to be affected. The following formula
calculates the last DataWindow to be affected.
If string data to be assigned to a single row and column has multiple lines (indicated by line
ending characters in the import string), you must quote the string data using ~". Do not use
single quotes.
This example of a valid import string assigns multiline values to each row in column 2:
ls_s = &
Usage
The file should consist of rows of data. If the file includes column headings or row labels, set
the startrow and startcolumn arguments to skip them. The data types and order of the
DataWindow object's columns must match the columns of data in the file.
The startcolumn and endcolumn arguments control the number of columns imported from the
file and the number of columns in the DataWindow that are affected. The dwstartcolumn
argument specifies the first DataWindow column to be affected. The following formula
calculates the last DataWindow to be affected.
To let users select the file to import, specify a NULL string for filename. PowerBuilder
displays the Select Import File dialog box. A dropdown listbox lets the user select the type of
file to import.
The type of file that can be imported using the ImportFile function varies depending on the
file's format and the version of PowerBuilder you are running.
File type File format that can be imported
.TXT Only Unicode files can be imported into the Unicode version of PowerBuilder.
Unicode files cannot be imported into the ANSI version of PowerBuilder
.DBF Files created using either the ANSI or Unicode version of PowerBuilder can be
imported into both versions
Other file related functions are file exist, file open, file length, file close, file seek, file write,
file delete, getfileopenname, getfilesavename.
23 What are the arguments in SqlPreview event? When does it get triggered?
Ans Occurs immediately before a SQL statement is submitted to the DBMS. Functions that trigger
DBMS activity are Retrieve, Update, and ReselectRow.
Arguments:- request SQLPreviewFunction by value (the function that initiated the database
activity)Values are:¨ PreviewFunctionReselectRow! — ReselectRow function¨
PreviewFunctionRetrieve! — Retrieve function¨ PreviewFunctionUpdate! — Update
function
sqltype SQLPreviewType by value (the type of SQL statement being sent to the DBMS)Values
are:¨ PreviewDelete! — A DELETE statement¨ PreviewInsert! — An INSERT
statement¨ PreviewSelect! — A SELECT statement¨ PreviewUpdate! — An
UPDATE statement
sqlsyntax String by value (the full text of the SQL statement)
buffer DWBuffer by value (the buffer containing the row involved in the database activity)
Values are:¨ Delete! — The delete buffer (data that has been deleted from the
DataWindow)¨ Filter! — The filter buffer (data that has been filtered out)¨ Primary! —
The primary buffer (data that has not been deleted or filtered out)
row Long by value (the number of the row involved in the database activity, that is, the row
being updated, selected, inserted, or deleted)
Return value
Long. Return code choices (specify in a RETURN statement):
0 Continue processing
1 Stop processing
2 Skip this request and execute the next request
Usage
¨ Changing the SQL to be executed (you can get the value of sqlsyntax, modify it, and
call SetSQLPreview)
¨ Keeping a record (you can write the SQL statement to a log file)
GetSQLPreview and binding When binding is enabled for your database, the SQL returned in
the GetSQLPreview event may not be complete—the input arguments are not replaced with the
actual values. For example, when binding is enabled, GetSQLPreview might return the
following SQL statement:
'3/1/94', '111' )
If you require the complete SQL statement for logging purposes, you should disable binding in
your DBMS.
If the row that caused the error is in the Filter buffer, you must unfilter it if you want the user to
correct the problem.
Reported row number The row number stored in row is the number of the row in the buffer,
not the number the row had when it was retrieved into the DataWindow object
24 How many triggers are there in oracle and what they are?
Ans There are 11 triggers used in oracle and they are –
On insert,update,delete
Before insert,update,delete
After insert,update,delete
On statement and on row.
25 What SetPosition function does?
Ans For controls in a window, specifies the position of a control in the front-to-back order within a
window. For a window, specifies whether it always displays on top of other open windows.
Controls
A control within a window or a window
Syntax
Syntax
LookupDisplay ( column )
Argument Description
column The column for which you want the code table display value
Return value
String. Returns the display value when it succeeds and the empty string ("") if an error occurs.
Usage
If a column has a code table, a buffer stores a value from the data column of the code table, but
the user sees a value from the display column. Use LookupDisplay to get the value the user
sees.
Code tables and data values and graphs When a column that is displayed in a graph has a code
table, the graph displays the data values of the code table by default. To display the display
values, call this function when you define the graph data.
33 What does the pb.ini do?
Ans When you run power builder it goes through the pb.ini which contains information about the
various painters, database profiles and many things and set the properties accordingly. If you
make any changes like created new profile the entry for that will be done in pb.ini.
34 For what the open event of application object is used?
Ans This event is getting called when the application starts so we can use this event to open first
frame window as well as making connection with the database or whatever operations you
want to do when the application starts.
35 How many events are there in application object? What they are?
Ans There are six events for the application object. they are –
Open, Close, System Error, Idle, ConnectionBegin, and ConnectionEnd.
36 From which pb object Error and Message object are inherited?
Ans PowerObject is the base object for all powerbuilder objects.
37 What are the global variables and objects in pb?
Ans Error, Message, SQLCA, SQLSA, SQLDA.
38 What are all the graph styles?
Ans Area, Bar, Column, Line, Pie, Scatter, 3D area, 3D Bar, 3D Column, 3D Line, 3D Pie,
Stacked Bar, Stacked Column, Solid Bar, Solid Column, Solid Stacked Column, Solid Stacked
Bar.
39 What are all DataWindow styles provided with pb?
Ans Composite, Freeform, N-Up, Tabular, Grid, Group, Label, CrossTab, Graph, OLE, RichText.
40 Difference between DataWindow and DataStore.
Ans A DataWindow is a visual object whereas a datastore is a non visual object. A datawindow
cannot be explicitly destroyed while a datastore can be destroyed. A datastore is basically used
for background processing inplace of cursors.
41 What are the difference between DataSource and DataStore?
Ans A datasource is the method used to populate data into a datawindow. While a datastore is a non
visual datawindow.
42 How can you get column level and row level item status?
Ans The second parameter to the getItemStatus function decides which status is being asked for. If
the second parameter is 0 then a row status is returned whereas if a no .(1,2,3 ..) is given then
the status for that column is returned.
Syntax
A value of the dwItemStatus enumerated data type. Returns the status of the item at row,
column of dwcontrol in dwbuffer. If column is 0, GetItemStatus returns the status of row. If
any argument's value is NULL, GetItemStatus returns NULL.
Usage
¨ NotModified! — The information in the row or column is unchanged from what was
retrieved.
¨ DataModified! — The information in the column or one of the columns in the row has
changed since it was retrieved.
¨ New! — The row is new but no values have been specified for its columns. (Applies to
rows only, not to individual columns.)
¨ NewModified! — The row is new, and values have been assigned to its columns. In
addition to changes caused by user entry or the SetItem function, a new row gets the status
NewModified! when one of its columns has a default value. (Applies to rows only, not to
individual columns.)
Use GetItemStatus to understand what SQL statements will be generated for new and changed
information when you update the database.
For rows in the primary and filter buffers, Update generates an INSERT statement for rows
with NewModified! status. It generates an UPDATE statement for rows with DataModified!
status. Only columns with DataModified! Status are included in the UPDATE statement.
For rows in the delete buffer, Update does not generate a DELETE statement for rows whose
status was New! or NewModified! Before being moved to the delete buffer.
43 What are the item statuses provided with pb?
Ans There are four Item Status. – NotModified!, DataModified!, New!, NewModified!.
44 What item status generates update statements?
Ans NewModified & DataModified.
45 How can you trap errors in pb?
Ans In the SystemError event, DB Error Event, ItemError Event.
46 What is the difference between PostEvent and TriggerEvent?
Ans Post event is placed at the end of the windows message object queue where as a triggerevent is
executed immediately.
TriggerEvent and PostEvent are useful for preventing duplication of code. If two controls
perform the same task, you can use PostEvent in one control's event script to execute the
other's script, instead of repeating the code in two places. For example, if both a button and a
menu delete data, the button's Clicked script can perform the deletion and the menu's Clicked
event script can post an event that runs the button's Clicked event script.
47 What are the differences between event and functions?
Ans An event can be extended but not overridden & overloaded whereas a function can be.
If an event is called dynamically then even if the event is not there at runtime it only returns a –
1 while in similar case a function will fire an error.
48 What are the scopes of variables? In which sequence does pb search for the variables?
Ans There are four scopes local, shared, global and instance and pb search variables in the same
order
49 What is the sequence for searching the files in pb applications?
Ans While running application from which directory application is running it will search in that
folder and then it follows windows sequence.
50 What all functions you can not call in ItemChanged event? Why?
Ans If you call any of the following function in item change event it will go in indefinite loop
because these functions call the item change event again. These events are –
Accept text all scroll functions, set row, set column
51 What are the return values of ItemChanged event?
Ans There are three return values in this event
Occurs when a field in a DataWindow control has been modified and loses focus (for example,
the user presses enter, the tab key, or an arrow key or clicks the mouse on another field within
the DataWindow). ItemChanged can also occur when the AcceptText or Update function is
called for a DataWindow control or DataStore object.
Event ID
Event ID Objects
pbm_dwnitemchange DataWindow control or DataStore
Arguments
Argument Description
row Long by value (the number of the row containing the item whose value has been
changed)
dwo DWObject by value (a reference to the column containing the item whose value has
been changed. Dwo is a reference to the column object, not the name of the column)
data String by value (the new data the user has specified for the item)
Return value
Long. Return code choices (specify in a RETURN statement):
Usage
The ItemChanged event does not occur when the DataWindow control itself loses focus. If the
user clicks on an Update or Close button, you will need to write a script that calls AcceptText
to see if a changed value should be accepted before the button's action occurs.
Obsolete techniques Information formerly provided by the GetText function is available in the
data argument.
Controls
Mismatched data types An execution error occurs when the data type of the DataWindow
column does not match the data type of the function, in this case String.
54 What are all buffers present in pb?
Ans Besically there are three buffers provided with the pb datawindows. They are given below-
Primary buffer,delete buffer, filter buffer.there is one more buffer called as original buffer that
is when we retrieve the datawindow data will be in original buffer.
55 What are the disadvantages of the triggers?
Ans First major disadvantage is that user will not have any control over process as the trigger fire
automatically on certain operations. Also user can not come to know that some thing has
happen on his operation as trigger fire in the background automatically.
56 What all are the ddl (data definition language) statements?
Ans All create statement are the ddl. As well as all grant and revoke statements are ddl
57 Can you write commit in triggers? Why?
Ans No we can not write commit in trigger because in triggers fire automatically on certain
operation. And if two users are using the same application and doing same operation on the
operation of one user commit will fire and some invalid data may get save.
58 Can you write create statement in procedure?
Ans Ans : Yes
58 How can you call procedure in pb
Ans Ans: There is a three ways from which you can call procedure in PB.
First is through the embeded sql, second is through the procedure datasource for making
datawindow objects and last is using RPC call through the transaction object.
59 How can you make datawindow from procedure?
Ans You can do so by using procedure type datasource for creating new datawindow object.
60 How can you update datawindow created from procedure?
Ans You need to do so from some other procedure Or through the explicit embedded update
statement.
61 Can you modify the SQL of DataWindow runtime? How?
Ans Yes we can modify the sql of the datawindow.
Specifies the SQL SELECT statement for a DataWindow control or DataStore.
Controls
Syntax
dwcontrol.SetSQLSelect ( statement )
Argument Description
dwcontrol The name of the DataWindow control, DataStore, or child DataWindow for
which you want to change the SELECT statement
Statement A string whose value is the SELECT statement for the DataWindow object.
The statement must structurally match the current SELECT statement (that is, it must return the
same number of columns, the columns must be the same data type, and the columns must be in
the same order)
Return value
Integer. SetSQLSelect returns 1 if it succeeds and -1 if the SELECT statement cannot be
changed. If any argument's value is NULL, SetSQLSelect returns NULL.
Usage
Use SetSQLSelect to dynamically change the SQL SELECT statement for a DataWindow
object in a script.
If the DataWindow is updatable, PowerBuilder validates the SELECT statement against the
database and DataWindow column specifications when you call the SetSQLSelect function.
Each column in the SQL SELECT statement must match the column type in the DataWindow
object. The statement is validated only if the DataWindow object is updatable.
You must use the SetTrans or SetTransObject function to set the transaction object before the
SetSQLSelect function will execute.
If the new SELECT statement has a different table name in the FROM clause and the
DataWindow object is updatable, then PowerBuilder must change the update information for
the DataWindow object. PowerBuilder assumes the key columns are in the same positions as in
the original definition. The following conditions will make the DataWindow not updatable:
If changing the SELECT statement makes the DataWindow object not updatable, the
DataWindow control cannot execute an Update function call for the DataWindow object in the
future.
Limitations to using SetSQLSelect Use SetSQLSelect only if the data source for the
DataWindow object is a SQL SELECT statement without retrieval arguments and you want
PowerBuilder to modify the update information for the DataWindow object:
dw_1.Modify("DataWindow.Table.Select='select...'")
Modify will not verify the SELECT statement or change the update information, making it
faster but more susceptible to user error. Although you can use Modify when arguments are
involved, it is not recommended because of the lack of checking.
62 What is exception error handling in oracle?
Ans
63 How can you get SQL statement of the datawindow objects?
Ans Reports the SQL SELECT statement associated with a DataWindow if its data source is one
that accesses an SQL database (such as SQL Select, Quick Select, or Query).
Controls
Syntax
dwcontrol.GetSQLSelect ( )
Argument Description
dwcontrol The name of the DataWindow control, DataStore, or child DataWindow for
which you want to obtain the current SELECT statement
Return value
String. Returns the current SQL SELECT statement for dwcontrol. GetSQLSelect returns the
empty string ("") if it cannot return the statement. If dwcontrol is NULL, GetSQLSelect
returns NULL.
Usage
When you want to change the SQL SELECT statement for a DataWindow or DataStore during
execution, you can use GetSQLSelect to save the current SELECT statement before making the
change.
When you define a DataWindow, PowerBuilder stores a PowerBuilder SELECT statement
(PBSELECT) with the DataWindow. If a database is connected and SetTransObject has been
called for the DataWindow, then GetSQLSelect returns the SQL SELECT statement.
Otherwise, GetSQLSelect returns the PBSELECT statement.
You can also use Describe to obtain the SQL SELECT statement. The DataWindow object's
Table.Select property holds the information.
For lists and explanations of DataWindow object properties, see the DataWindow Reference.
Controls
Syntax
dwcontrol.Modify ( modstring )
Argument Description
dwcontrol The name of the DataWindow control, DataStore, or child DataWindow you
are modifying
modstring A string whose value is the specifications for the modification. See Usage for
appropriate formats
Return value
String. Returns the empty string ("") if it succeeds and an error message if an error occurs. The
error message takes the form "Line n Column n incorrect syntax". The columns are counted
from the beginning of the compiled text of modstring. If any argument's value is NULL,
Modify returns NULL.
Usage
Modify lets you make many of the same settings in a script that you would make in the
DataWindow painter. Typical uses for Modify are:
You can use three types of statements in modstring to modify a DataWindow object.
Statement type Use to
CREATE object (settings) Adds object to the DataWindow object (such as text,
computed fields, and bitmaps). Settings is a list of properties and values using the format you
see in exported DataWindow syntax. To create an object, you must supply enough information
to define it.Object cannot be an OLE object. You cannot add an OLE object to a DataWindow
using the Modify function
DESTROY [COLUMN] object Removes object from the DataWindow object. When object is
a column name, specify the keyword COLUMN to remove both the column and the column's
data from the buffer
objectname.property=value Changes the value of property to value. Properties control the
location, color, size, font, and other settings for objectname. When objectname is DataWindow,
you can also set properties for database access. The DataWindow Reference has lists of objects
in a DataWindow, their properties, and values.Depending on the specific property, value can
be:¨ A constant¨ A quoted constant¨ An expression that consists of a default value
followed by a valid DataWindow expression that returns the appropriate data type for the
property. Expressions are described below
Object names
The DataWindow painter automatically gives names to columns and column labels. Other
objects that you add to the DataWindow object are named with a cryptic string of numbers
unless you give them names. (Describe will report the cryptic names, but you can't see them in
the painter.) To easily describe and modify properties of an object, give the object a name.
When you specify an expression for a DataWindow property, the expression has the format:
defaultvalue~tDataWindowpainterexpression
Defaultvalue is a value that can be converted to the appropriate data type for the property. It is
followed by a tab (~t). DataWindowpainterexpression is an expression that can use any
DataWindow painter function. The expression must also evaluate to the appropriate data type
for the property. When you are setting a column's property, the expression is evaluated for each
row in the DataWindow, which allows you to vary the display based on the data. A typical
expression uses the If function:
'16777215 ~t If(emp_status=~~'A~~',255,16777215)'
To use that expression in a modstring, specify the following (entered as a single line):
modstring = "emp_id.Color='16777215 ~t
If(emp_status=~~'A~~',255,16777215)'"
Not all properties accept expressions. For details on each property, see the DataWindow
Reference.
Because Modify's argument is a string, which can include other strings, you need to use special
syntax to specify quotation marks. To specify that a quotation mark be used within the string
rather than match and end a previously opened quote, you can either specify the other style of
quote (single quotes nested with double quotes) or precede the quotation mark with a tilde (~).
For another level of nesting, the string itself must specify ~", so you must specify ~~ (which
specifies a tilde) followed by ~" (which specifies a quote). For example, another way to type
the modstring shown above is (entered as a single line):
modstring = "emp_id.Color=~"16777215 ~t
If(emp_status=~~~"A~~~",255,16777215)~""
For more information about quotes and tildes, see "Standard data types".
To use variable data in modstring, you can build the string using variables in your program. As
you concatenate sections of modstring, make sure quotes are included in the string where
necessary. For example, the following code builds a modstring similar to the one above, but the
default color value and the two color values in the If function are calculated in the script.
Notice how the single quotes around the expression are included in the first and last pieces of
the string:
red_amount = Integer(sle_1.Text)
"~tIf(emp_status=~~'A~~'," + &
"," + &
The following is a simpler example without the If function. You don't need quotes around the
value if you are not specifying an expression. Here the String and RGB functions result in a
constant value in the resulting modstring:
You can set several properties with a single call to Modify by including each property setting
in modstring separated by spaces. For example, assume the following is entered on a single line
in the script editor:
rtn = dw_1.Modify("emp_id.Font.Italic=0
oval_1.Background.Mode=0
oval_1.Background.Color=255")
However, it is easier to understand and debug a script in which each call to Modify sets one
property.
Debugging tip If you build your modstring and store it in a variable that is the argument for
Modify, you can look at the value of the variable in Debug mode. When Modify's error
message reports a column number, you can count the characters as you look at the compiled
modstring.
Modifying a WHERE clause For efficiency, use Modify instead of SetSQLSelect to modify a
WHERE clause. Modify is faster because it does not verify the syntax and does not change the
update status of the DataWindow object. However, Modify is more susceptible to user error.
SetSQLSelect modifies the syntax twice (when the syntax is modified and when the retrieve
executes) and affects the update status of the DataWindow object.
PowerBuilder already includes many functions for modifying a DataWindow. Before using
Modify, check the list of DataWindow functions in Objects and Controls to see if a function
exists for making the change. Many of these functions are listed below in See also.
Modify is for modifying the properties of a DataWindow object. You can set properties of the
DataWindow control that contains the object using standard dot notation. For example, to put a
border on the control, specify:
Controls
Syntax
When rows are inserted When a row is inserted into a DataWindow, it initially has a row
status of New!, and all columns in that row initially have a column status of NotModified!.
After data has changed in a column in the row, either because the user changed the data or the
data was changed programmatically, such as through the SetItem function, the column status
changes to DataModified!. Once the status for any column in the inserted row changes to
DataModified!, the row status changes to NewModified!.
When a DataWindow column has a default value, the column's status does not change to
DataModified! until the user makes at least one actual change to a column in that row.
When Update is called
A row's status flag determines what SQL command the Update function uses to update the
database. INSERT or UPDATE is called depending upon the following row statuses:
Row status SQL statement generated
NewModified! INSERT
DataModified! UPDATE
A column is included in an UPDATE statement only if the following two conditions are met:
¨ The column is on the updatable column list maintained by the DataWindow object
For more information about setting the update characteristics of the DataWindow object, see
the PowerBuilder User's Guide.
The DataWindow control includes all columns in INSERT statements it generates. If a column
has no value, the DataWindow attempts to insert a NULL. This causes a database error if the
database does not allow NULLs in that column.
Use SetItemStatus when you want to change the way a row will be updated. Typically, you do
this to prevent the default behavior from taking place. For example, you might copy a row from
one DataWindow to another. After the user modifies the row, you want to issue an UPDATE
statement instead of an INSERT statement.
Changing column status You use SetItemStatus to change the column status from
DataModified! to NotModified!, or vice versa.
Change column status when you change row status Changing the row status will change the
status of all columns in that row to NotModified!, so if the Update function is called, no SQL
update is produced. You must change the status of columns to be updated after you change the
row status.
Changing row status Changing row status is a little more complicated. The following table
illustrates the effect of changing from one row status to another:
Original status Specified status
New! NewModified! DataModified! NotModified!
New! - Yes Yes No
NewModified! No - Yes New!
DataModified! NewModified! Yes - Yes
NotModified! Yes Yes Yes -
In the preceding table, Yes means the change is valid. For example, issuing SetItemStatus on a
row that has the status NotModified! to change the status to New! does change the status to
New!.
No means that the change is not valid and the status is not changed.
Issuing SetItemStatus to change a row status from NewModified! to NotModified! actually
changes the status to New!. Issuing SetItemStatus to change a row status from DataModified!
to New! actually changes the status to NewModified!.
Changing a row's status to NotModified! or New! causes all columns in that row to be assigned
a column status of NotModified!. Change the column's status to DataModified! to ensure that
an update results in a SQL UPDATE.
Changing the status of a retrieved row from NotModified! to New! If you change the status of
a retrieved row to New! and then make a change to data in a column, all the columns in that
row will change status to DataModified! All the columns change status because the Update
function generates a SQL INSERT command that includes the changed data as well as the data
that already existed in the other columns.
A cursor is a symbolic name that is associated with a Transact-SQL select statement through a
declaration statement. It consists of the following parts:
·cursor result set - the set (table) of rows resulting from the execution of a query associated
with the cursor
·cursor position - a pointer to one row within the cursor result set
The cursor position indicates the current row of the cursor. You can explicitly modify or delete
that row using delete or update statements with a clause naming the cursor. You change the
current cursor position through an operation called a fetch. A fetch moves the current cursor
position one or more rows down the cursor result set.
A cursor behaves much like a file pointer to a series of file records, where the cursor acts as a
pointer to the query results. However, cursors only support forward (or sequential) movement
through the query results. Once you fetch several rows, you cannot backtrack through the
cursor result set to access them again. This process allows you to traverse the query results row
by row, similar to how a programming language can access one file record at a time.
·Closed - The cursor result set does not exist, so you cannot read information from it. Cursors
are initially in this state. You must explicitly open the cursor before you can use it. Once it is
opened, you can explicitly close it when you are finished. SQL Server can implicitly close a
cursor for several reasons described later in this chapter.
·Open - The rows within the cursor result set are available for reading or updating.
You can close a cursor and then reopen it. Reopening a cursor recreates the cursor result set
and positions the cursor right before the first row. This allows you to process through a cursor
result set as many times as needed. You can close the cursor at any time; you do not have go
through the entire result set.
All cursor operations like fetching or updating the row are accomplished in reference to the
current cursor position. Updating cursor rows involves changing data in the row or deleting the
row completely. You cannot use cursors to insert rows. All updates through a cursor affects the
corresponding base tables included in the cursor result set.
76 What are different joins?
Ans Joining two or more tables is a process of comparing the data in specified fields and using the
comparison results to form a new table from the rows that qualify. A join statement specifies a
column from each table, compares the values in those columns row by row, and combines rows
with qualifying values into new rows. The comparison is usually for equality-values that match
exactly-but other types of joins can be specified. If a join is to have meaningful results, the
columns being compared must have similar values-values that are comparable because they
have the same or similar datatypes.
The join operation has a jargon all its own. The word "join" is used both as a verb, and as a
noun, referring to the operation itself, to the query, or to its results.
There are several varieties of joins-equijoin, natural join, outer join, and so
·Take parameters
·Return a status value to a calling procedure or batch to indicate success or failure, and the
reason for failure
The ability to write stored procedures greatly enhances the power, efficiency, and flexibility of
SQL. Compiled procedures dramatically improve the performance of SQL statements and
batches. In addition, stored procedures on other SQL Servers can be executed if your server
and the remote server are both set up to allow remote logins. You can write triggers on your
local SQL Server that execute procedures on a remote server whenever certain events, such as
deletions, updates or inserts, take place locally.
Stored procedures differ from ordinary SQL statements and from batches of SQL statements in
that they are pre-compiled. The first time you run a procedure, SQL Server's query processor
analyze it and prepare an execution plan that is ultimately stored in a system table.
Subsequently, the procedure is executed according to the stored plan. Since most of the query
processing work has already been performed, stored procedures execute almost
instantaneously.
SQL Server supplies a variety of stored procedures as convenient tools for the user. These
stored procedures are called system procedures.
You create stored procedures with the create procedure command. To execute a stored
procedure, either a system procedure or a user-defined procedure, use the execute command.
Or you can use the name of the stored procedure alone, as long as it is the first word of a
statement or batch.
The syntax for creating a simple stored procedure, without special features such as parameters,
is:
as SQL_statements
Stored procedures are database objects, and their names must follow the rules for identifiers.
Any number and kind of SQL statements can be included with the exception of create
statements.
78 What is structure?
Ans: A structure is a collection of one or more related variables of the same or different data
types grouped under a single name. In some languages, such as Pascal and COBOL, structures
are called records. Structures allow you to refer to related entities as a unit rather than
individually. For example, if you define the user's ID, address, access level, and a picture
(bitmap) of the employee as a structure called user_struct, you can then refer to this collection
of variables as user_struct.
There are two kinds of structures:
·Object-level structures, which are associated with a particular type of object such as a window
or menu. These structures can always be used in scripts for the object itself. You can also
choose to make the structures accessible from other scripts.
·Global structures, which are not associated with any object in your application. You can
directly reference these structures anywhere in your application.
79 What is mean by table mutation?
Ans
80 What is the difference between delete and truncate statement?
Ans Delete statement can be used to delete specific no. of records where as truncate will delete all
the records at a time. Delete statement make entry in to database log so that it is slower than
truncate also you can not get back the records which are truncated but we can in case of delete.
81 Can you create multiple transaction objects in pb?
Ans Yes you can create multiple transaction objects using create statement.
82 What is two tier and three tier architecture?
Ans Two tire architecture means there will be only front end and back end and we write our
business process in back end or front end. In case of three tires architecture there is one more
layer in between in which we write our business processes. Two tire is faster and economical
as compare to three tire. If in future some conversion take place or some changes has been
taken place in the business process in case of three tire architecture things goes smoothly while
in two tire architecture creates complications.
83 What is thin layer and thick layer database?
Ans
84 What is parsing in oracles?
Ans
85 What are the databases provided with Sybase?
Ans There are four system database and one sample database when you install the sybase on your
machine they are Master, Model, sybsystemproc, temparory database and the pub2 is the
sample database.
86 What SQL does Sybase use?
Ans Sybase uses T SQL means transact sql which is the extention to SQL.
87 What SQL does oracle use?
Ans Oracle uses SQL Plus which is the extension to SQL.
88 What is the minus of two tables?
89 How can you get the procedure definations in oracle?
90 Write query to find second highest salary
91 Write query to get department having max emp.
92 What is full and incremental exe?
93 What is machine code exe?
Ans : Machine code is nothing but DLL
94 How can you create pbd and dll with exe?
If you select machine code option and select the pbd option for pbls while creating the exe will
generate dlls and without selecting machincode you can generates pbd.
95 Can you create single pbd or dll .how?
Ans: Yes, by selecting only that pbl.
96 What is the difference between pbd and dll?
DLL : 1. It takes much time to create the EXE
2. Faster than the PBD.
PBD 1. It not takes much time to create the EXE
2. Slower than the DLL
97 What is pbr? What is the use of it? How will you create it?
Ans: PowerBuilder Resource (PBR) file that includes resources that are assigned dynamically
in scripts for the application. The name of each object must exactly match the name used to
reference the object in scripts (if the name is fully qualified in the script it must be fully
qualified in the PBR file).
98 Can you create exe with out pbd and dll?
Ans : Yes
99 What is check in and check out? What is use of it?
Check in – now any user having access to it can use that object.
Check out – now some body is using that object and no body can use that object.
This provides security and control over maintianing versions.
100 Can you update procedure definition through pb?
No.
101 Can you set QueryMode to DataWindow which you are using in share data? What will
happen?
No. if you do so it will raise runtime error.
102 Can you pass parameter to procedure dynamically?
Yes. While executing the procedure dynamically.
103 What will happen if we write script in other event?
Ans: Occurs when a system message occurs that is not a PowerBuilder message. You should
avoid using it (it slows performance while it checks every Windows message).
104 Difference between Pb And VB.
Pb follows OOPs concept while Vb does not. There is a facility called datawindow through
which we can present data from database directly which is not in VB.
105 What are the datawindow object sources types?
Ans: 1. Quick Select 2. Sql Select 3. Query 4. External 5. Store Procedure
106 For what the external DataWindow objects are used?
Ans: When we have to write the complicated query or joins then we used external
datawindow. And basically we use external datawindow for reports purpose. If we are not
using any DBMS or RDBMS.
107 What is the difference between quick select and SQL select?
Ans: In the Quick Select dialog box, you can choose columns from one table or from multiple
tables if they are joined through foreign keys. You can not sort and group the columns and
specify retrieval criteria and you can not add computed column. Which all are possible in sql
select.
Windowvar The name of the window you want to display. You can specify a window
object defined in the Window painter (which is a window data type) or a variable of the desired
window data type. Open places a reference to the open window in windowvar
ParameterThe parameter you want to store in the Message object when the window is opened.
Parameter must have one of these data types:¨ String¨ Numeric¨ PowerObject
parent (child and popup windows only) (optional) The window you want make the
parent of the child or popup window you are opening. If you open a child or popup window
and omit parent, PowerBuilder associates the window being opened with the currently active
window
Return value
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is NULL,
OpenWithParm returns NULL.
109 Whet is the difference between popup and response window?
Ans: Child A window that is dependent on a main window and can only exist within the main
(parent) window.
Main: A standalone overlapped window that can be independent of all other windows.
MDI: An MDI frame without a MicroHelp status bar.
MDIHelp: An MDI frame with a MicroHelp status bar.
Popup: A window that displays usually in response to an event within a window, but can exist
outside of the window and, in some cases, after the window that opened it is closed.
Response: A window that displays to obtain information from the user and cannot lose focus or
be closed until the user responds.
110 Difference between OpenSheet and Open function.
Ans: open: Opens a window object of a known data type. Open displays the window and
makes all its properties and controls available to scripts.
Open ( windowvar {, parent } )
OpenSheet : Description
Opens a sheet within an MDI (multiple document interfaces) frame window and creates a menu
item for selecting the sheet on the specified menu.
Argument Description
sheetrefvar The name of any window variable that is not an MDI frame window.
OpenSheet places a reference to the open sheet in sheetrefvar
windowtype (optional) A string whose value is the data type of the window you want to open.
The data type of windowtype must be the same or a descendant of sheetrefvar
mdiframe The name of an MDI frame window
position (optional) The number of the menu item (in the menu associated with the sheet)
to which you want to append the names of the open sheets. Menu bar menu items are numbered
from the left, beginning with 1. The default value of 0 lists the open sheets under the next-to-
last menu item
arrangeopen (optional) A value of the ArrangeOpen enumerated data type specifying how you
want the sheet arranged in the MDI frame in relation to other sheets when it is opened:¨
Cascaded! — (Default) Cascade the sheet relative to other open sheets, so that its title
bar is below the previously opened sheet¨ Layered! — Layer the sheet so that it fills the
frame and covers previously opened sheets¨ Original! — Open the sheet in its original size
and cascade it
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is NULL,
OpenSheet returns NULL.
111 What is the alternative to store data temporarily?
Ans: We can cache the data in the datastore object temporarily.
112 Define datawindow.
Ans: You place DataWindow controls in a window or user object and then specify the
DataWindow object you want to use within them to display and manipulate data in the
window.
A DataWindow object allows users to display, manipulate, and update database or other
information. You build DataWindow objects in the DataWindow painter.
It has five datasource and Eleven Styles to display the data.
113 What will happen if you write MessageBox in ItemFocusChanged event? Why?
Message will display once and then nothing will happened because when we loose the focus
from one object to other item focus change never triggers .
114 What are the different types of windows provided in pb?
Ans : Child, Main, MDI, MDI help, Popup, Response
115 What is the difference between pb5 and pb6
116 What are the different types of datawindow object style?
Ans : Composite, Compose, Grid, Graph, Crosstab, N-up, Tabular, Freeform, OLE, Label,
RichText
117 What are the events in application objects?
Ans: Open, Close, ConnectionBegin, ConnectionEnd, idel, systemerror
118 Can you inherit datawindow objects?
Ans: We can not directly inherit the datawindow object but indirectly we can do that by using
user Object.
119 What is the purpose of using user objects?
Ans: For the memory Management and applying oops concepts.
120 When does ItemFocusChanged event fires?
Ans: Occurs when the current item in the control changes.
121 When does ItemError event triggers?
Ans: Occurs when a field has been modified, the field loses focus (for example, the user
presses enter, tab, or an arrow key or clicks the mouse on another field in the DataWindow),
and the data in the field does not pass the validation rules for its column. ItemError can also
occur when a value imported into a DataWindow control or DataStore does not pass the
validation rules for its column.
122 What are the methods of software engineering?
123 What are the steps in SDLC?
Ans : WaterFall
Conception
Initiation
Analysis
Design
Coding
Testing
Implementation
124 What are the different types of testing?
Basically there are four type of testing
Unit testing – done by programmer
Integration testing – when the entire module get integrated.
System testing –
User level testing –
Top down testing, bottom up testing, black box testing, white box testing.
125 What is paroto diegram.
126 How can you estimate the time required to finish one job?
127 What values does any SQL will return?
Sqlcode –
Sqlnrows -
Sqlerrtext -
128 If you do not write commit then what will happen?
Ans: When you write the commit statement then only dada is permanently stored in database.
When you close the ORACLE session the oracle automatically committed the data that is in
buffer.
129 Can you inherit user object?
Ans: Yes.
130 What are the parameters in RetrieveStart, RetrieveEnd, RetrieveRow events?
131 What will happen if we delete rows from a datawindow whose update property is false?
These deleted rows will not go to the delete buffer it will work as RowsDiscard function.
132 How can you move rows from one datawindow to other and datawindow to buffer?
RowsMove()
133 What are the difference between Sybase and oracle?
134 What is thick and thin database structure?
138 What is for ResetUpdate function is used.
139 What is dde
Dynamic data exchange.
140 What all functions fire on calling update function?
Ans: Updates the database with the changes made in a DataWindow control or DataStore.
Update can also call AcceptText for the current row and column before it updates the database.
dwcontrol.Update ( { accept {, resetflag } } )
Argument Description
dwcontrol The name of the DataWindow control, DataStore, or child DataWindow that
contains the information you want to use to update the database
accept (optional) A boolean value specifying whether the DataWindow control or
DataStore should automatically perform an AcceptText prior to performing the update:¨
TRUE — (Default) Perform AcceptText. The update is canceled if the data fails
validation¨ FALSE — Do not perform AcceptText
resetflag (optional) A boolean value specifying whether dwcontrol should automatically
reset the update flags:¨ TRUE — (Default) Reset the flags¨ FALSE — Do not reset the
flags
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is NULL,
Update returns NULL.
205 How can you execute any exe through the pb.
Ans Using run function with the name of exe.
206 What is rowsread and rowswritten.
Ans Rowsread - The number of rows written by the pipeline.
Rowswritten - The number of rows written by the pipeline.
207 What is the RPC call.
Ans RPC is the remote procedure call.A stored procedure in a database that you can call from a
script. The declaration for an RPC can be global or local (belonging to an object). The
definition for the procedure is in the database
208 What is sqlpreview event and when these get triggers. What are the parameters.
209 Can you define arguments to a user define event
Ans : Yes, we can define argument in user difined event.
210 What is the use of event id in events
Ans :
211 Can you change the presentation style of a datawindow.
Ans : Yes we can export the datawindow object and then we can changed the parameter
processing = 1 then it will convert it to GRID style.
212 Can you change the ancester of a user object.
yes
213 What are the object at client side and server side in distributed applications
214 What differences are there regarding distributed application.
215 What is proxy objects
Ans Ans :It is a copy of server side objects with which your client object communicates and pass re
You can not make proxy object in pb5 but is possible in pb6.
216 Is it neccessory to have same name for client and server side objects.
Ans It is neccessory in pb5 not in pb6
218 Can you write user event in menu object.
Ans Ans : No since menu is the window object which we can not modify through th ePower
Builder.
219 What is datawindow child objects.
Ans : A DataWindowChild object is a nested report or a DropDownDataWindow within a
DataWindow object. For example, a DataWindow object that populates a column having the
DropDownDataWindow edit style is a DataWindowChild object.The 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.
220 What is % row type datatype in oracle.
221 How can change the messagebox title for datawindow error?
Ans The title of the dialog box that displays when an error occurs.
Controls
DataWindows
Syntax
Dot notation:
dw_control.Object.DataWindow.Message.Title
Describe and Modify argument:
SyntaxFromSQL: