You are on page 1of 137

POWERBUILDER INTRVIEW Q and A

1 Ans. How can you generate runtime datawindow object? Using syntaxfromsql function to get sqlsyntaxt for the passed sql string and then calling function create SyntaxFromSQL: transaction.SyntaxFromSQL ( sqlselect, presentation, err ) Argument Description Transaction. object The name of a connected transaction

Sqlselect. A string whose value is a valid SQL SELECT statement Presentation. A string whose value is the default presentation style you want for the DataWindow. The simple format is: Style(Type=presentationstyle)Values for presentationstyle correspond to the styles in the New DataWindow dialog box in the DataWindow painter. Keywords are:

1

(Default) TabularGridForm (for freeform)GraphGroupLabelNup. The Usage section lists the keywords you can use in presentation. err A string variable to which PowerBuilder will assign any error messages that occur Return value String. Returns the empty string ("") if an error occurs. If SyntaxFromSQL fails, err may contain error messages if warnings or soft errors occur (for example, a syntax error). If any argument's value is NULL, SyntaxFromSQL returns NULL. Syntax of 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

2 Ans. How can you open a userobject or tabcontrol in a window? 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 } ) Argumen Description

3

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 Ans. What is garbage collection and what are the functions to set and get garbage time limit? 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.

4

When garbage collection occurs Garbage collection occurs: ¨ When a reference is removed from an object A reference to an object is any variable whose value is the object. When the variable goes out of scope, or when it is assigned a differenent value, PowerBuilder removes a reference to the object, counts the remaining references, and destroys the object if no references remain. ¨ When the garbage collection interval is exceeded When PowerBuilder completes the execution of a systemtriggered event, it makes a garbage collection pass if the set interval between garbage collection passes has been exceeded. The default interval is 0.5 seconds. The garbage collection pass removes any objects and classes that cannot be referenced, including those containing circular references (otherwise unreferenced objects that reference each other). Posting events and functions When you post an event or function and pass an object reference, PowerBuilder adds an internal reference to the object to prevent it from being garbage collected between the time of the post and the actual execution of the event or function. This reference is removed when the event or function is executed. Exceptions to garbage collection

5

There are a few objects that are prevented from being garbage collected: ¨ Visual objects Any object that is visible on your screen 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. Controlling when garbage collection occurs 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.

6

4 Ans Give some example of function overloading? Messagebox(),Open(),opentab(),openuserobject() etc. all these functions are overloaded because there are more than one function with same name in same class with different number of parameter. 5 Ans Can you open a response window with opensheet function? 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 Ans Can you open more that one response window at the same time.and why? No, you can not open multiple response windows at the same time because when you open one response window It expects some input from user then only it proceed further. 7 Ans

7

You can inherit the user object and window so which one is preferable and why? User object is preferable because it takes less memory because in memory structure there 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 Ans What is the return value of describe and modify function? 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

8

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. If any argument's value is NULL, Describe returns NULL. 9 Ans Can you copy data from one datawindow to other? And how? Yes, we can copy data from one datawindow to other. To do so we can use function 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

9

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.

10

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. Uses for RowsCopy include: ¨ 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 Ans Can you copy data from one buffer to other within the same DataWindow and how? Yes, we can copy data from one datawindow to other. To do so we can use function rowscopy. dwcontrol.RowsCopy (startrow, endrow, copybuffer, targetdw, beforerow, targetbuffer ) Argument Description

11

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

12

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. Uses for RowsCopy include: ¨ 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

13

Ans How can you move record from one datawindow to other and one buffer to other? 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

14

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'

15

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. Uses for RowsMove include: ¨ 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 Ans How can you delete or filter the records with out sending them to buffer? We can do so by using rowsdiscard function.

16

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

17

prevents the rows from being deleted when you call Update. To clear all the rows from a DataWindow control, use Reset. 13

Ans If the datawindow update property is false and you applied a delete function to some records what will happen? In this case deleted rows will not go to the delete buffer. This time delete work as rowsdiscard function 14 Ans How can you make sharing of datawindow off? 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

18

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 Ans What are the restrictions to share data between to datawindow? dwprimary.ShareData ( dwsecondary ) Argument Description Dwprimary The name of the primary DataWindow. The primary DataWindow is the owner of the data. When

19

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: SELECT dept_id from dept SELECT dept_id from dept where dept_id = 200 SELECT dept_id from employee 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.

20

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

21

GetSQLSelect ImportFile ImportString ImportClipboard InsertRow ReselectRow Reset Retrieve SetFilter SetSort SetSQLSelect Sort Update Computed fields in secondary DataWindow controls A secondary DataWindow control can only have data which is in the primary DataWindow control. If you add a computed field to a secondary control, it will not display when you run the application unless you also add it to the primary control. 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.

22

Crosstab DataWindows You cannot use ShareData with Crosstab DataWindows. Distributed applications You cannot share data between a DataWindow control in a client application and a DataStore in a server application. 16 Ans What are the four methods of dynamic sql? Describe it. Dynamic SQL syntax format 1: Use this format to execute a SQL statement that does not produce a result set and does not require input parameters. You can use this format to execute all forms of Data Definition Language (DDL). Dynamic SQL Syntax format 2: Use this format to execute a SQL statement that does not produce a result set but does require input parameters. You can use this format to execute all forms of Data Definition Language (DDL). Syntax PREPARE DynamicStagingArea FROM SQLStatement {USING TransactionObject} ; EXECUTE DynamicStagingArea USING {ParameterList} ;

23

Parameter Description DynamicStagingArea The name of the DynamicStagingArea (usually SQLSA)If you need a DynamicStagingArea variable other than SQLSA, you must declare it and instantiated it with the CREATE statement before using it SQLStatement A string containing a valid SQL statement. The string can be a string constant or a PowerBuilder variable preceded by a colon (such as :mysql). The string must be contained on one line and cannot contain expressionsEnter a question mark (?) for each parameter in the statement. Value substitution is positional; reserved word substitution is not allowed. TransactionObject (optional) The name of the transaction object that identifies the database ParameterList (optional). A comma-separated list of PowerScript variables. Note that PowerScript variables are preceded by a colon (:) Usage To specify a NULL value, use the SetNull function.

24

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 DECLARE Cursor | Procedure DYNAMIC CURSOR | PROCEDURE FOR DynamicStagingArea ; PREPARE DynamicStagingArea FROM SQLStatement {USING TransactionObject} ; OPEN DYNAMIC Cursor {USING ParameterList} ;

EXECUTE DYNAMIC Procedure {USING ParameterList} ; FETCH Cursor | Procedure CLOSE Cursor | Procedure ; Parameter Description Cursor or Procedure The name of the cursor or procedure you want to use DynamicStagingArea The name of the DynamicStagingArea (usually SQLSA)If you need a INTO HostVariableList ;

25

DynamicStagingArea variable other than SQLSA, you must declare it and instantiate it with the CREATE statement before using it. SQLStatement A string containing a valid SQL SELECT statement The string can be a string constant or a PowerBuilder variable preceded by a colon (such as :mysql). The string must be contained on one line and cannot contain expressions Enter a question mark (?) for each parameter in the statement. Value substitution is positional; reserved word substitution is not allowed. TransactionObject (optional) The name of the transaction object that identifies the database ParameterList (optional). A comma-separated list of PowerScript variables. Note that PowerScript variables are preceded by a colon (:) HostVariableList The list of PowerScript variables into which the data values will be retrieved. Usage To specify a NULL value, use the SetNull function. The DECLARE statement is not executable and can be declared globally.

26

If your DBMS supports formats of FETCH other than the customary (and default) FETCH NEXT, you can specify FETCH FIRST, FETCH PRIOR, or FETCH LAST. The FETCH and CLOSE statements in Format 3 are the same as in standard embedded SQL. To declare a global, shared, or instance cursor or procedure, select Global Variables, Instance Variables, or Shared Variables on the Declare menu of the PowerScript painter. To declare a local cursor, click the Paint SQL button in the PainterBar. 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

27

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 For information about these functions, see GetDynamicDate, GetDynamicDateTime, GetDynamicNumber, GetDynamicString, and 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!

28

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.

29

17 Ans What is the SQLSA? 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 dsa_stage1 = CREATE DynamicStagingArea 18 Ans

30

What is the SQLDA? DynamicDescriptionArea is a PowerBuilder data type. PowerBuilder uses a variable of this type to store information about the input and output parameters used in Format 4 of dynamic SQL. 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 dsa_desc1 = CREATE DynamicDescriptionArea 19 Ans What is the deligation? In service type application architecture we will have requester and service providers in delegation we have

31

association and aggregation . aggregation means the service object can work in association with requester only they can not work independently exa. Sort service, filter service,serch service etc. and Association means service provider can work independently. Exa. String and date objects 20 Ans What is the difference between computed column and computed field? Computed column means the column defined at sql mode through compute option. And computed field means we add control in to your datwindow object from control list.

21 Ans How importstring function works what is the argument to it? Inserts data into a DataWindow control or DataStore from tab-delimited data in a string.

32

Controls DataWindow controls, DataStore objects, and child DataWindows Syntax dwcontrol.ImportString ( string {, startrow {, endrow {, startcolumn {, endcolumn {, dwstartcolumn } } } } } ) Argument Description Dwcontrol The name of the DataWindow control or DataStore to which you want to copy data from the specified string String A string from which you want to copy the data. The string should contain tab-delimited columns with one row per line (see Usage) startrow (optional) The number of the starting row of data in the string you want to import. If the first row contains headings that you want to skip, set startrow to 2. The default is 1 endrow (optional) The number of the last row of data in the string that you want to import. The default is all rows startcolumn (optional) The number of the first column in the string that you want to import. The default is 1

33

endcolumn (optional) The number of the last column in the string that you want to import. The default is the rest of the columns dwstartcolumn (optional) The number of the first column in the DataWindow control or DataStore object that you want to receive data. The default is 1 ImportString may trigger an ItemError event. Return value Long. Returns the number of rows that were imported if it succeeds and one of the following negative integers if an error occurs: -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 If any argument's value is NULL, ImportString returns NULL. 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-

34

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: col1_data~t col2_data~t col3_data~t col4_data~r~n 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. dwstartcolumn + ( endcolumn - startcolumn ) 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:

35

ls_s = & "1~t~"Mickey~r~nMinnie~r~nGoofy~" ~r~n" + & "2~t~"Susan~r~nMary~r~nMarie~" ~r~n" + & "3~t~"Chris~r~nBen~r~nMike~" ~r~n" + & "4~t~"Mott~r~nBarber~r~nPicard~" " 22 Ans What is the import file functions and tell other functions related to it? Inserts data into a DataWindow control or DataStore from a file. The data can be tab-delimited text or dBase format 2 or 3. Controls DataWindow controls, DataStore objects, and child DataWindows Syntax Dwcontrol.ImportFile ( filename {, startrow {, endrow {, startcolumn {, endcolumn {, dwstartcolumn } } } } } ) Argument Description

36

Dwcontrol The name of the DataWindow control or DataStore to which you want to copy data from the specified file. Filename A string whose value is the name of the file from which you want to copy data. The file must be an ASCII, tab-delimited file (TXT) or a dBase format 2 or 3 file (DBF). Specify the file's full name, which must end in the appropriate extension.If filename is NULL, ImportFile displays the File Open dialog box and allows the user to select a file. startrow (optional) The number of the first row in the file that you want to copy. If the first row contains headings that you want to skip, set startrow to 2. The default is 1 endrow (optional) The number of the last row in the file that you want to copy. The default is the rest of the rows startcolumn (optional) The number of the first column in the file that you want to copy. The default is 1 endcolumn (optional) The number of the last column in the file that you want to copy. The default is the rest of the columns

37

dwstartcolumn (optional) The number of the first column in the DataWindow control or DataStore that you want to receive data. The default is 1 ImportFile may trigger an ItemError event. Return value Long. Returns the number of rows that were imported if it succeeds and one of the following negative integers if an error occurs: 0 End of file; too many rows -1 No rows -2 Empty file -3 Invalid argument -4 Invalid input -5 Could not open the file -6 Could not close the file -7 Error reading the text -8 Not a TXT file -9 The user canceled the import -10 Unsupported dBase file format (not version 2 or 3) 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.

38

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. Dwstartcolumn + (endcolumn - startcolumn) 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. Importing files into the ANSI and Unicode versions of PowerBuilder 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

39

.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 Ans What are the arguments in sqlpreview event. When does it get triggered? 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

40

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 statement) String by value (the full text of the SQL

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

41

Usage Obsolete functions Information formerly provided by GetSQLPreview and GetUpdateStatus is available in the arguments sqlsyntax , row, and buffer. Some uses for the sqlsyntax argument are: ¨ 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: INSERT INTO "cust_order" ( "ordnum", "custnum","duedate", "balance" ) VALUES ( ?, ?, ?, ? ) When binding is disabled, it returns:

42

INSERT INTO "cust_order" ( "ordnum", "balance","duedate", "custnum" ) VALUES ( '12345', 900,'3/1/94', '111' ) If you require the complete SQL statement for logging purposes, you should disable binding in your DBMS. For more information about binding, see Connecting to Your Database. 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 Ans How many triggers are there in oracle and what they are? There are 11 triggers used in oracle and they are – 1. On insert,update,delete 2. 3. 4. Before insert,update,delete After insert,update,delete On statement and on row.

43

25 Ans What setposition function does? 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 Objectname.SetPosition ( position {, precedingobject } ) Argument Description Objectname The name of a control for which you want to specify a location in the front-to-back order within the window, or the name of a window for which you want to specify whether it will always display on top. Objectname cannot be a child window or a sheet. Position A SetPosType enumerated data type. The values you can specify depend on whether objectname is a control or a window. For controls, values are:

44

¨Behind! — Position objectname behind precedingobject in the order¨ ToTop! — Position objectname on top of all other controls¨ ToBottom! — Position objectname behind all other controls For windows, values are:¨ TopMost! — Always display objectname on top of all other open windows¨ NoTopMost! — Do not always display objectname on top of all other open windows precedingobject (optional) The name of the object you want to position objectname behind. Precedingobject is required if position is Behind! Return value Integer. Returns 1 when it succeeds and -1 if an error occurs. If any argument's value is NULL, Set Position returns NULL. Usage The front-to-back order for controls determines which control covers another when they overlap. If a control completely covers another control, the control that is in back becomes inaccessible to the user. When you specify TopMost! for more than one window, the most recently executed SetPosition function controls which window displays on top.

45

26 Ans What are the painters provided in the Power builder? There are 14 painter in pb. They are – Application, window, userobject, menu, functions, structure, datawindow, library, project, report, database, table, query, pipeline. 27 Ans If the page size is go down or is less what error does Sybase gives? Low pges size error will come. 28 Ans Why the user events are not given on menu? Events of menu are mapped with windows menu event, which we can not modify through the power builder. 29

46

Ans How the package function in oracle calls in pb? Through RPC call. 30 Ans What is the object coupling? This is nothing but delegation, which includes aggregation & association.

31 Ans What functions we generally used in closequery event and what does it triggers? Closequery occurs before the close event, so we can give an overriding message whether the user wants to save before closing. 32 Ans What is the lookupdisplay function?

47

Obtains the display value in the code table associated with the data value in the specified column. 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 Ans

48

What the pb.ini does? 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 Ans What for the open event of application object is used. 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 Ans How many events are there in application object and what they are? There are six event for the application object. They are – Open, Close, System Error, Idle, Connection Begin, and Connection End. 36

49

Ans From which pb object error and message object are inherited? PowerObject is the base object for all powerbuilder objects. 37 Ans What are the global variables and objects in pb? Error, Message, SQLCA, SQLSA, SQLDA. 38 Ans What all are the graph styles? 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 Ans What all datawindow styles are provided with pb?

50

Composite, Freeform, N-Up, Tabular, Grid, Group, Label, CrossTab, Graph, OLE, RichText. 40 Ans Difference between datawindow and datastores? 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 in place of cursors. 41 Ans What are the difference between datasource and datastores? A datasource is the method used to populate data into a datawindow. While a datastore is a non visual datawindow. 42 Ans How can you get column level and row level item status?

51

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 dwcontrol.GetItemStatus ( row, column, dwbuffer ) Argument Description dwcontrol The name of the DataWindow control, DataStore, or child DataWindow in which you want to obtain the status of a row or a column in a row row A long identifying the row for which you want the status column The column for which you want the status. Column can be a column number (integer) or a column name (string). Specify 0 to get the status of the whole row. Dwbuffer A value of the dwBuffer enumerated data type identifying the DataWindow buffer that contains the row: ¨Primary! — The data in the primary buffer (data that has not been deleted or filtered out) ¨Delete! — The data in the delete buffer (data deleted from the DataWindow object)

52

¨Filter! — The data in the filter buffer (data that was filtered out) Return value 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 The values of the dwItemStatus enumerated data type are: ¨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.)

53

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 Ans What are the item status provided with pb? There are four ItemStatus. – NotModified!, DataModified!, New!, NewModified!. 44 Ans

54

What item status generate update statements? NewModified & DataModified. 45 Ans How can you trap errors in pb? In the SystemError event, DB Error Event, ItemError Event. 46 Ans What is the difference between post event and triggerevent? 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.

55

47 Ans What are the difference between event and functions? A event can be extended but not overrided & overloaded whereas a function can be. If a 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 Ans What are the scope of variables and in which sequence pb search for the variables? There are four scopes local, shared, global and instance and pb search variables in the same order 49 Ans What is the sequence for searching the files in pb applications? While running application from which directory application is running it will search in that folder and then it follows windows sequence.

56

50 Ans What all functions you can not call in itemchange event and why? 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 Ans What are the return values of item change event? 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

57

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): 0 (Default) Accept the data value 1 Reject the data value and don't allow focus to change 2 Reject the data value but allow the focus to change 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. Instead of calling SetActionCode, use a RETURN statement with a return code. 52

58

Ans If you want to call update function in itemchange event what cares you need to take? When you call the update function in item change event we need to accept the value of lastly modified column.but we can not call the accept text function in the item change event so we need to set the value to that column using set text function. 53 Ans How can you get values from original buffer? Gets data whose type is String from the specified buffer of a DataWindow control or DataStore object. You can obtain the data that was originally retrieved and stored in the database from the original buffer, as well as the current value in the primary, delete, or filter buffers. Controls DataWindow controls, DataStore objects, and child DataWindows Syntax dwcontrol.GetItemString ( row, column {, dwbuffer, originalvalue } )

59

Argument Description Dwcontrol The name of the DataWindow control, DataStore, or child DataWindow in which you want to obtain the string data contained in a specific row and column Row: A long identifying the row location of the data

Column: The column location of the data. The data type of the column must String. Column can be a column number (integer) or a column name (string). To get the contents of a computed field, specify the name of the computed field for column. Computed fields do not have numbers Dwbuffer: (optional) A value of the dwBuffer enumerated data type identifying the DataWindow buffer from which you want to get the data: Primary! — (Default) The data in the primary buffer (data that has not been deleted or filtered out)¨ Delete! — The data in the delete buffer (data deleted from the DataWindow)¨ Filter! — The data in the filter buffer (data that was filtered out) originalvalue (optional) A Boolean indicating whether you want the original or current values for row and column:

60

¨True — Return the original values (the values initially retrieved from the database) ¨False — (Default) Return the current valuesIf you specify dwbuffer, you must also specify originalvalue Return value String. Returns NULL if the column value is NULL. Returns the empty string ("") if an error occurs. If any argument's value is NULL, GetItemString returns NULL. Usage Use GetItemString to get information from the DataWindow's buffers. To find out what the user entered in the current column before that data is accepted, use GetText. In the ItemChanged or ItemError events, use the data argument. To access a row in the original buffer, specify the buffer that the row currently occupies (primary, delete, or filter) and the number of the row in that buffer. When you specify TRUE for originalvalue, the function gets the original data for that row from the original buffer. 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 Ans

61

What all buffers are present in pb? Basically there are three buffers provided with the pb DataWindows. They are given below Primaries 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 Ans What are the disadvantages of the triggers? 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 Ans What all are the ddl (data definition language) statements? All create statement are the ddl. As well as all grant and revoke statements are ddl. 57

62

Ans Can you write commit in triggers and why? 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 Ans Can you write create statement in procedure? Yes 59 Ans How can you call procedure in pb? There is a three ways from which you can call procedure in PB. First is through the embedded sql , second is through the procedure datasource for making datawindow objects and last is using RPC call through the transaction object. 60

63

Ans How can you make datawindow from procedure? You can do so by using procedure type datasource for creating new datawindow object. 61 Ans How can you update datawindow created from procedure? You need to do so from some other procedure Or through the explicit embaded update statement. 62 Ans Can you modify the sql of datawindow runtime and how? Yes we can modify the sql of the datawindow. Specifies the SQL SELECT statement for a DataWindow control or DataStore. Controls DataWindow controls, DataStore objects, and child DataWindows Syntax

64

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

65

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: ¨ There is more than one table in the FROM clause. ¨ A DataWindow update column is a computed column in the SELECT statement. 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:

66

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. 63 Ans How can you get sql statement of the datawindow objects? 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 DataWindow controls, DataStore objects, and child DataWindows Syntax dwcontrol.GetSQLSelect ( ) Argument Description

67

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.

68

64 Ans. How can you update multiple tables in a datawindow? We can update multiple table by updating one table by calling update function and then calling describe and modify function to set database table and updateable column and reset the modify flag to update next table. 65 Ans. How can you set attribute of datawindow? We can set the attribute of datawindow using modify function as well as using datawindow.object.column.attribute = some valid value. And dot notation.

66 Ans. How can you get the attribute of the datawindow? We can get the attribute of the datawindow by using describe function.

69

67 Ans If you pass only empty string with modify function what will happen? Modifies a DataWindow object by applying specifications, specified as a list of instructions that change the DataWindow object's definition. You can change appearance, behavior, and database information for the DataWindow object by changing the values of properties. You can add and remove objects from the DataWindow object by providing specifications for the objects. For lists and explanations of DataWindow object properties, see the DataWindow Reference. Controls DataWindow controls, DataStore objects, and child DataWindows Syntax dwcontrol.Modify ( modstring ) Argument Description dwcontrol The name of the DataWindow control, DataStore, or child DataWindow you are modifying

70

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: ¨ Changing colors, text settings, and other appearance settings of objects ¨ Changing the update status of different tables in the DataWindow so that you can update more than one table ¨ Modifying the WHERE clause of the DataWindow object's SQL SELECT statement ¨ Turning on Query mode or Prompt For Criteria so users can specify the data they want ¨ Changing the status of Retrieve Only As Needed

71

¨ Changing the data source of the DataWindow object ¨ Controlling the Print Preview display ¨ Deleting and adding objects (such as lines or bitmaps) in the DataWindow object Each of these uses is illustrated in the Examples for this function. You can use three types of statements in modstring to modify a DataWindow object. CREATE object (settings) Adds object to the DataWindow object (such as text, computed fields, and bitmaps). A setting 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

72

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. Expressions for Modify 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

73

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. Quotes and tildes 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

74

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". Building a modstring with variables 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) modstring = "emp_id.Color='" + & String(RGB(red_amount, 255, 255)) + &

75

"~tIf(emp_status=~~'A~~'," + & String(RGB(255, 0, 0)) + & "," + & String(RGB(red_amount, 255, 255)) + & ")'" 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: modstring = "emp_id.Color=" + & String(RGB(red_amount, 255, 255)) 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

76

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

77

that contains the object using standard dot notation. For example, to put a border on the control, specify:

68 Ans How can we set itemstatus of the datawindows. Changes the modification status of a row or a column within a row. The modification status determines the type of SQL statement the Update function will generate for the row. Controls DataWindow controls, DataStore objects, and child DataWindows Syntax dwcontrol.SetItemStatus ( row, column, dwbuffer, status ) Argument Description dwcontrol The name of the DataWindow control, DataStore, or child DataWindow in which you want to set the status of an item at a specified row and column

78

row A long identifying the row location in which you want to set the status column The column location in which you want to set the status. Column can be a column number (integer) or a column name (string). To set the status for the row, enter 0 for column dwbuffer A dwBuffer enumerated data type identifying the DataWindow buffer that contains the row: ¨PRIMARY! — The data in the primary buffer (the data that has not been deleted or filtered out) ¨DELETE! — The data in the delete buffer (data deleted from the DataWindow object) ¨FILTER! — The data in the filter buffer (data that was filtered out) status A dwItemStatus enumerated data type representing the new status: ¨NotModified!¨ DataModified!¨ New!¨ NewModified!For definitions of the values of dwItemStatus, see GetItemStatus Return value Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is NULL, SetItemStatus returns NULL. Usage How statuses are set

79

There are four DataWindow item statuses, two of which apply only to rows: Status Applies to New! Rows NewModified! Rows NotModified! Rows and columns DataModified! Rows and columns When data is retrieved When data is retrieved into a DataWindow, all rows and columns initially have a status of NotModified!. After data has changed in a column in a particular row, either because the user changed the data or the data was changed programmatically, such as through the SetItem function, the column status for that column changes to DataModified!. Once the status for any column in a retrieved row changes to DataModified!, the row status also changes to DataModified!. 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

80

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 updateable 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 column has a column status of DataModified! The DataWindow control includes all columns in INSERT statements it generates. If a column has no value, the

81

DataWindow attempts to insert a NULL. This causes a database error if the database does not allow Null’s in that column. Changing statuses using SetItemStatus 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

82

New! NewModified! NotModified! New! Yes No NewModified! No DataModified! NewModified! NotModified! Yes

DataModified! Yes Yes Yes Yes New! 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

83

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. Changing status indirectly When you cannot change to the desired status directly, you can usually do it indirectly. For example, change New! to DataModified! To NotModified!. Resetting status for the whole DataWindow object To reset the update status of the entire DataWindow object, use the ResetUpdate function. This sets all status flags to NotModified! Except for New! Status flags, which remain, unchanged. 69 Ans What all are the datawinsdow styles and datasources in pb? Data window styles – grid, group, n-app, label, tabular, cross tab, composite, graph, ole, ritchtext, free form. Datasource – Query, Quick Select, Stored Procedures, External, SQL Select 70 Ans How pb implements oops concept?

84

Basically OOP s include inheritance, Polymorphism and encapsulation. And pb implement these all through the objects like window, user objects. 71 Ans What is overwriting the functions? Suppose you have a object having one function and you have inherited another object from the existing one and define the same function with same signature the function will get overwrite this is call the function overwriting. 74 Ans What is the linkage service in PFC. The PFC linkage service helps you to create master/detail windows and other types of windows that require coordinated processing. The linkage service contains the following features: |Linkage style Controls whether detail DataWindows retrieve rows, filter rows, or scroll to the appropriate row |Update style Controls how the linkage service updates DataWindows (top-down, bottom-up, top-down then bottom-up, bottom-up then top-down, or a developerspecified custom update)

85

|Confirm on row change When the master changes rows, this option displays a confirmation dialog if modifications made to detail DataWindows will be lost |Confirm on delete Displays a confirmation dialog when the user deletes rows |Cascading key changes The linkage service automatically updates detail DataWindows when you change a key value on the master |Delete style When you delete a master row, this option specifies whether the linkage service deletes detail rows, discards detail rows, or leaves them alone |Extended update Allows you to integrate other controls (such as ListViews, TreeViews, and DataStores) into the default save process The linkage service is completed integrated with n_cst_luw and with the w_master pfc_Save process. PFC enables the linkage service through the n_cst_dwsrv_linkage user object. Usage You can use the linkage service to coordinate any type of processing among DataWindows. However, the most common use is for master/detail processing. to enable the linkage service: Call the u_dw of_SetLinkage function: dw_emplist.of_SetLinkage(TRUE) U_dw destroys the service automatically when the DataWindow is destroyed.

86

To use the linkage service to coordinate Master/Detail processing: 1 Enable the linkage service for both the master and detail DataWindows by calling the u_dw of_SetLinkage function, once for each DataWindow: dw_master.of_SetLinkage(TRUE) dw_detail.of_SetLinkage(TRUE) 2 Call the u_dw of_SetTransObject function to establish the Transaction object for the master and detail DataWindows: dw_master.inv_linkage.of_SetTransObject(SQLCA) 3 Link the detail to the master by calling the of_SetMaster function in the detail DataWindow: dw_detail.inv_linkage.of_SetMaster(dw_master) 4 Register the related columns by calling the of_Register function: dw_detail.inv_linkage.of_Register & ("emp_id","emp_id") 5 (Optional) Specify that the service updates DataWindows from the bottom of the linkage chain on up (the default is to update top down): dw_detail.inv_linkage.of_SetUpdateStyle & (dw_detail.inv_linkage.BOTTOMUP)

87

6 Establish the action taken by the detail when a row changes in the master by calling the of_SetStyle function. This example specifies that the detail DataWindow retrieves a row whenever the master changes: dw_detail.inv_linkage.of_SetStyle & (dw_detail.inv_linkage.RETRIEVE) 7 Call the master DataWindow's of_Retrieve function: IF dw_master.of_Retrieve( ) = -1 THEN MessageBox("Error","Retrieve error") ELSE Dw_master.SetFocus( ) END IF Previous steps can be in one script You can code the previous steps in a single event, such as the window Open event. 8 Add retrieval logic to the master DataWindow's pfc_Retrieve event: Return this.Retrieve( ) Retrieving rows If the linkage service refreshes detail rows via retrieval, you only need to code a Retrieve function for the master DataWindow. With the filter and scroll options, you must also code Retrieve functions in detail DataWindows. To enable confirm on row change (retrieval style only):

88

1 Call the of_SetUpdateOnRowChange function for the detail DataWindow: dw_detail.inv_linkage.of_SetUpdateOnRowChange(TRUE ) 2 Call the of_SetConfirmOnRowChange function for the detail DataWindow: dw_detail.inv_linkage.of_SetConfirmOnRowChange & (TRUE) To enable confirm on delete: 1 Call the of_SetUpdateOnRowChange function for the detail DataWindow: dw_detail.inv_linkage.of_SetUpdateOnRowChange(TRUE ) 2 Call the of_SetConfirmOnDelete function for the detail DataWindow: dw_detail.inv_linkage.of_SetConfirmOnDelete(TRUE) To enable cascading key changes: Call the of_SetSyncOnKeyChange function for every DataWindow in the linkage chain: dw_master.inv_linkage.of_SetSyncOnKeyChange(TRUE) dw_detail.inv_linkage.of_SetSyncOnKeyChange(TRUE) vTo specify deletion style: |Call the of_SetDeleteStyle function for all master DataWindows in the linkage chain: dw_master.inv_linkage.of_SetDeleteStyle &

89

(dw_cust.inv_linkage.DISCARD_ROWS) To enable extended update: Call the of_SetOtherSaveObjects function to add other controls to the default save process: PowerObject lpo_objs[ ] // This example adds the lv_salesinfo ListView // to the save process. lpo_objs[1] = lv_salesinfo dw_master.inv_linkage.of_SetOtherSaveObjects & (lpo_objs) 75 Ans. What is the datawindow cashing service in pfc and what is the use of it? The DataWindow caching service buffers data for DataWindow objects. By keeping rows in memory, the DataWindow caching service helps to reduce database access, optimizing application performance. The DataWindow caching service supports the following data sources: lDataWindow object (using either data retrieved from the database or data stored with the DataWindow object) lSQL statement lDataWindow control

90

lDataStore control lRows from an array lA file The DataWindow caching service uses PowerBuilder DataStores to buffer data. PFC enables DataWindow caching through the n_cst_dwcache user object. PFC code is in ancestor-level objects This book always refers to extension-level objects (such as n_cst_dwcache). All PFC code is actually in ancestor-level objects (such as pfc_n_cst_dwcache). Usage Use DataWindow caching to minimize database access and optimize performance. To enable DataWindow caching: Call the n_cst_appmanager of_SetDWCache function: gnv_app.of_SetDWCache(TRUE) To use DataWindow caching: Cache data by calling the of_Register function, passing different arguments depending on the data to be cached: lTo cache rows retrieved from the database via a DataWindow object, pass an identifier, a Transaction object, the DataWindow object name, and arguments if any lTo cache rows retrieved from the database via a SQL statement, pass an identifier, a Transaction object, and the SQL statement

91

lTo cache rows in an array, pass an identifier, the DataWindow object name, and the data lTo cache rows from a DataWindow control, pass an identifier and the DataWindow control lTo cache rows from a DataStore, pass an identifier and the DataStore instance lTo cache rows from a file, pass an identifier and the filename 2 To determine if a DataWindow object is already registered with the caching service, call the of_IsRegistered function, passing the object's identifier. 3 To access cached data from, call the of_GetRegistered function. This example assumes an ids_datastore instance variable: gnv_app.inv_dwcache.of_GetRegistered & ("d_emplist", ids_datastore) ids_datastore.ShareData(dw_emplist) 4 To reretrieve data for a cached DataWindow, call the of_Refresh function. 5 To stop caching call the of_UnRegister function. 6 (Optional) Disable the DataWindow caching service by calling the n_cst_appmanager of_SetDWCache function: gnv_app.of_SetDWCache(FALSE)

92

In most cases, you do not disable DataWindow caching explicitly. PFC destroys n_cst_dwcache automatically when your application shuts down. 76 Ans. What is the difference in parameter to functions by value and by reference? By value means it creates its own copy to work and if we make the changes in any thing it will affect in copy not in actual objects. But parameter by reference means variable keeps the reference of the object and there will not be any copy whatever changes we will do will takes place in the actual objects value. 77 Ans. What is the cursor and what are the types of cursor? Cursor is the pointer, which point to a record and allow us to do row by row manipulations. 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:

93

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. After you declare the cursor, it is in one of two states: 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

94

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. 78 Ans What are different joins? 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

95

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 79 Ans. What are the stored procedure what is the use of it? Stored procedures are collections of SQL statements and control-of-flow language. An execution plan is prepared when a procedure is run, so that subsequent execution is very fast. Stored procedures can: Take parameters Call other procedures

96

Return a status value to a calling procedure or batch to indicate success or failure, and the reason for failure Return values of parameters to a calling procedure or batch Be executed on remote SQL Servers 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 precompiled. The first time you run a procedure, SQL Server's query processor analyzes it and prepares 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.

97

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: create procedure procedure_name 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. 80 Ans: What are the structures?

98

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. 81 Ans What is mean by table mutation?

82

99

Ans What is the difference between delete and truncate statement? Delete statement can be used to delete specifice 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. 83 Ans Can you create multiple transaction objects in pb? Yes you can create multiple transaction objects using create statement. 84 Ans What is two tier and three-tier architecture? 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 tires are faster and economical as

100

compare to three tires. 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. 85 Ans What is thin layer and thick layer database?

86 Ans What is parsing in oracles? 87 Ans What are the databases provided with sybase? There are four-system databases and one sample database when you install the Sybase on your machine they are Master, Model, sybsystemproc, temporary database and the pub2 is the sample database. 88 Ans What sql Sybase uses?

101

Sybase uses T SQL means transact sql which is the extension to SQL. 89 Ans What sql oracle uses? Oracle uses SQL Plus, which is the extension to SQL. 90 What is the minus of two tables?

Questions 91-120
91 How can you get the procedure definitions in oracle? 92 Write query to find second highest salary?

93 Write query to get department having max emp.? 94 What is full and incremental exe.

102

95 Ans : What is machine code exe?

Machine code is nothing but DLL 96 Ans : 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. 97 Ans. Can you create single pbd or dll .how? Yes, by selecting only that pbl. 98 Ans. What is the difference bitween 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

103

2. Slower than the DLL 99 Ans.: What is PBR and what is the use of it? And how will you create it? 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). 100 Ans. Yes 101 Ans. it? What are check in and check out and what is use of

Can you create exe with out pbd and dll?

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 maintaining versions.

104

102 Ans. No. 103

Can you update procedure definition through pb?

Ans. 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. 104 Ans. Can you pass parameter to procedure dynamically?

Yes. While executing the procedure dynamically. 105 Ans. What will happen if we write script in other event?

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). 106 Ans. Difference between Pb And VB?

105

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. 107 Ans. What are the datawindow objects sources types?

1. Quick Select 2. Sql Select 3. Query 4. External 5. Store Procedure. 108 Ans. What for the external datawindow objects are used?

When we have to write the complicated query or joins then we used external datawindow. And basically we use external datawindow for report purpose. If we are not using any DBMS or RDBMS.. 109 Ans. What is the difference between quick select and sql select? 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

106

columns and specify retrieval criteria and you can not add computed column. Which all are possible in sql select. 110 Ans. What is function openwithparm and what are the parameters to it? Opens a window object of a known data type. OpenWithParm displays the window and makes all its properties and controls available to scripts. It also stores a parameter in the system's Message object. OpenWithParm ( windowvar, parameter {, parent } ) 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 Parameter The 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

107

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. 111 Ans. Whet is the difference between pop up and response window? 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. 112 Ans. Difference between opensheet and open function?

108

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 interface) frame window and creates a menu item for selecting the sheet on the specified menu. OpenSheet ( sheetrefvar {, windowtype }, mdiframe {, position {, arrangeopen } } ) 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

109

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-tolast 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 Returns Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is NULL, OpenSheet returns NULL.

113 Ans. What is the alternative to store data temporarily? We can cache the data in the datastore object temporarily. 114

110

Ans.

Define datawindow.

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. 115 Ans. What will happen if you write messagebox in itemfocus change event and why? Message will display once and then nothing will happen because when we loose the focus from one object to other item focus change never triggers. 117 Ans. pb? What are the different type of windows provided in

111

Child, Main, MDI, MDI help, Popup, Response 118 What is the difference between pb5 and pb6? 119 Ans. style? What are the different type of datawindow object

Composite, Compose, Grid, Graph, Crosstab, N-up, Tabular, Freeform, OLE, Label, RichText 120 Ans. What are the events in application objects?

Open, Close,ConnectionBegin,ConnectionEnd,idel,systemerror

Questions 121-150
121 Ans. Can you inherit datawindow objects?

112

We can not directly inherited the datawindow object but indirectly we can do that by using user Object. 122 Ans. What is the purpose of using user objects?

For the memory Management and applying oops concepts. 123 Ans. When does item focus change event fires?

Occurs when the current item in the control changes. 124 Ans. When does itemerror event triggers?

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.

113

125 126 Ans.

What are the methods of software engineering?

What are the steps in SDLC?

WaterFall Conception Initiation Analysis Design Coding Testing Implementation. 127 Ans. What are the different types of testing?

Basically there are four type of testing Unit testing – done by programmer Integration testing – when all the module get integrated. System testing – User level testing – Top down testing ,bottom up testing, black box testing, white box testing.

114

128 What is paroto diegram? 129 How can you estimate the time required finishing one job? 130 Ans. What values any sql will return?

Sqlcode – Sqlnrows Sqlerrtext – 131 Ans. If you do not write commit then what will happen?

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. 132 Ans. Can you inherit user object?

115

Yes. 133 What are the parameters in retrievestart, retrieveend, and retrieverow events? 134 Ans. 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 rowsdescard function. 135 Ans. How can you move rows from one datawindow to other and datawindow to buffer? Rowsmove() 136 What are the difference between sybase and oracle? 137 What is thick and thin database structure? 138 What is for resetupdate function is used? 139

116

Ans. What is dde? Dynamic data exchange. 140 Ans. What all functions fire on calling update function?

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:

117

¨TRUE — (Default) Reset the flags¨ FALSE — Do not reset the flags Return: Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is NULL, Update returns NULL. Update may trigger these events: DBError SQLPreview UpdateEnd UpdateStart If AcceptText is performed, it may trigger these events: ItemChanged ItemError 141 What is encapsulation, inheritance, polymorphism & give at least one example of each one of them? 142 Ans. What the describe will return if you do not pass any expression?

118

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 property list. 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. If any argument's value is NULL, Describe returns NULL. 143 Ans. Can you open multiple response windows at the same time? No, When the one Response window get close then only second window is open. 144 What are the registry related functions provided with pb? 145

119

Ans. What is the difference between settrans and settransobject? In most cases, use the SetTransObject function to specify the transaction object. It is more efficient and allows you to control when changes to the database get committed. SetTrans copies the values from a specified transaction object to the internal transaction object for the DataWindow control or DataStore. When you use SetTrans in a script, the DataWindow uses its internal transaction object and automatically connects and disconnects as needed; any errors that occur cause an automatic rollback. With SetTrans, you do not specify SQL statements, such as CONNECT, COMMIT, and DISCONNECT. The DataWindow control connects and disconnects after each Retrieve or Update function. Use SetTrans when you want PowerBuilder to manage the database connections automatically because you have a limited number of available connections or will be use the application from a remote location. SetTrans is appropriate when you are only retrieving data and do not need to hold database locks on records the user is modifying. However, for better performance, you should use SetTransObject. 146 dll? How can you call the external function from

120

147 pfc? 148 pfc?

What all application services provided with the

What all window services provided with the

149 What all are the datawindow services provides with the pfc? 150 How many layers of pbls are in pfc and what they are? 151 What is deligation? 152 What is the difference between operator overloading and polymorphism? 153 Write down query to find out duplicate rows? 154 If four records with same data in all column are there how can you delete two of it in oracle? 155 What all tables get updated when you create a procedure?

121

156 Ans. What is the advantage of the procedure? Procedure is stored in database. So it is faster than any other Query. 157 Ans. Where can you get the definition of sp in oracle? There is a one table from which we can get the definition of SP. 158 In joins and subquery which one is preferable and why? 159 Can you have the script of any function in ancestor in the descendent object function? If not how can you get it? 160 Ans. What is yield function?

122

Yields control to other graphic objects, including objects that are not PowerBuilder objects. Yield checks the message queue and if there are messages in the queue, it pulls them from the queue. Return value Boolean. Returns TRUE if it pulls messages from the message queue and FALSE if there are no messages. Usage Include Yield within a loop so that other processes can happen. For example, use Yield to allow end users to interrupt a loop. By yielding control, you allow the user time to click on a cancel button in another window. Then code in the loop can check whether a global variable's status has changed. You can also use Yield in a loop in which you are waiting for something to finish so that other processing can take place, in either your or some other application. 161 What is the cluster and non cluster index in Sybase? 162 What is the cluster in oracle? 163

123

What is the sequence and what is the use of it in oracle? 164 What will happen if I call one event in other and other in first event? 165 Why we should write cursor in sp not directly? 166 What is the exception and error handeling? 167

What is the function of setredraw function? Controls the automatic redrawing of an object or control after each change to its properties. Objectname.SetRedraw ( boolean ) Argument Description Objectname The name of the object or control for which you wants to change the redraw setting. Objectname can be a child DataWindow, but cannot be a menu.

124

Boolean A boolean value that controls whether PowerBuilder redraws an object automatically after a change. Values are: ¨TRUE — Automatically redraw the object or control after each change to its properties¨ FALSE — Do not redraw after each change Return value Integer. Returns 1 if it succeeds and -1 if an error occurs. If boolean is NULL, SetRedraw returns NULL. 168 How can we get column modified? 169 Can you open response window using opensheet function if yes what will happen? 170 What are the functions to set and get garbage collection time limit? 171 What is for setforegroundwindow is used? 172 Ans. What for setformat function used?

125

Specifies a display format for a column in a DataWindow control or DataStore. DataWindow controls, DataStore objects, and child DataWindows Syntax dwcontrol.SetFormat ( column, format ) Argument Description Dwcontrol The name of the DataWindow control, DataStore, or child DataWindow in which you want to specify the display format Column : The column for which you are specifying the display format. Column can be a column number (integer) or a column name (string) Format : A string whose value is the display format for the DataWindow column Return value Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is NULL, SetFormat returns NULL. The return value is usually not used. 173 What is the pixeltounits function? 174

126

Ans. How can we get the environment? Gets information about the operating system, processor, and screen display of the system. GetEnvironment ( environmentinfo ) Argument Description Environmentinfo The name of the Environment object that will hold the information about the environment Return value Integer. Returns 1 if it succeeds and -1 if an error occurs. If environmentinfo is NULL, GetEnvironment returns NULL 175 What events get fire on calling update functions.and what are the parameter in update function? 176 What values we can send with open with param? 177 Ans. When does idle event fire? Occurs when the Idle function has been called in an application object script and the specified number of seconds has elapsed with no mouse or keyboard activity.

127

178 Ans. When does systemerror event fire? Occurs when a serious execution time error occurs (such as trying to open a nonexistent window). 179 What are the connection begin and connection end event? 180 Ans. What does classname function return? Provides the class (or name) of the specified object. controlname.Classname ( ) Argument Description Controlname The name of the control for which you want to know the name assigned to the control in the style window (the class of the control)

Return value

128

String. Returns the class of controlname, the name assigned to the control. Returns the empty string ("") if an error occurs. If controlname is NULL, ClassName returns NULL.

Questions 181-221
181 What does typeof function return? 182 What does setlibrarylist function do? 183 What does getapplication function return? 184 How can we get next modified row and column? 185 When does updatestart6 and updateend event fire.what are the argument to these events? 186 What all events get fire on calling any scrolling function?

129

187 What will return by the function getbandatpointer? 188 When does sqlpreview event get fire? 189 What is ISO and CMM. What are the differences? 190 What is quality control and quality assurance? 191 What is normalization and de normalization? 192 Describe various normal forms? 193 What is ER diagrams? 194 What is DFDs? 195 What all models are there?

130

196 What is difference between query with in and exist operator and which one is preferable? 197 What is outer join? 198 What is the package in oracle and what is the use of it? 199 Ans. Can you write create statement in procedure? Yes 200 What all locks provided in Sybase? 201 What are the durty tables and magic tables in Sybase? 202 What is a transaction?

131

203 List down the NVO user object. 1. Connection 2. ContextInformation 3. ContextKeyword 4. Datastore 5. Dynamicdescriptionarea 6. DynamicStagingarea 7. Error 8. Inet 9. Internetresult 10. Mailsession 11. Message 12. Oleobject 13. Olestorage 14. Olestream 15. Pipeline 16. Profiling 17. Service 18. Timing 19. TraceTree 20. Transaction 21. Transport 203 What is the keyword that used only in menu? Parentwindow – which gives you the name of the window to which the menu assigned.

132

204 How to get handle to a printer? 205 Ans How can you execute any exe through the pb? Using run function with the name of exe. 206 Ans What is rowsread and rowswritten? Rowsread - The number of rows written by the pipeline. Rowswritten - The number of rows written by the pipeline. 207 Ans What is the RPC call? 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.

133

208 What is sqlpreview event and when these get triggers? What are the parameters? 209 Ans. Can you define arguments to a user define event? Yes, we can define argument in user difined event. 210 What is the use of event id in events? 211 Ans. Can you change the presentation style of a datawindow? 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

134

213 What are the object at client side and server side in distributed applications? 214 What differences are there regarding distributed application? 215 Ans What is proxy objects? 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 Ans Is it neccessory to have same name for client and server side objects? It is neccessory in pb5 not in pb6 218

135

Ans Can you write user event in menu object? No since menu is the window object which we can not modify through th ePower Builder. 219 What is datawindow child objects? 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 Ans How can change the messagebox title for datawindow error?

136

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: "DataWindow.Message.Title { = ' titlestring ' }" SyntaxFromSQL: DataWindow(Message.Title = ' titlestring ' ) Parameter Description titlestring A string containing the title that displays in the title bar of the DataWindow dialog box that displays when an error occurs.

137