PeopleCode Interview Questions – Part1

by Prashant on January 16, 2013

in PeopleSoft Careers

What is the difference between SQL Object and SQL Exec?

SQL Object can be used with Fetch to return multiple rows, whereas SQLExec can fetch only one row.

What is the difference between User defined and System Defined Variables?

User-defined variables These variable names are preceded by an & character wherever they appear in a program. Variable names can be 1 to 1000 characters, consisting of letters A-Z and a-z, digits 0-9, and characters #, @, $, and _.
System variables System variables provide access to system information. System variables have a prefix of the % character, rather than the & character. Use these variables wherever you can use a constant, passing them as parameters to functions or assigning their values to fields or to temporary variables.

What are various types of User Defined Variables?

  • Global

The variable is valid for the entire session. A global variable must be declared, however, in each PeopleCode program where it’s used. Use global variables rarely, because they are difficult to maintain.

  • Component

The variable is valid while any page in the component in which the variable is defined stays active. Similar to a global variable, a component variable must be declared in each PeopleCode program where it’s used.

  • Local

The variable is valid for the duration of the PeopleCode program or function in which the variable is defined. If you do not declare a variable, it’s automatically declared with the scope Local and the data type Any.

You can declare variables using the Global, Local, or Component statements, or you can use local variables without declaring them. Here are some examples:

Local Number &AGE;

Global String &OPER_NICKNAME;

Component Rowset &MY_ROWSET;

Local Any &SOME_FIELD;

Local ApiObject &MYTREE;

Local Boolean &Compare = True;

 

Variable declarations are usually placed above the main body of a PeopleCode program (along with function declarations and definitions). The exception is the Local declaration, which you can use within a function or the main section of a program.

What is the difference between Get and Create functions in Instantiating Objects?

Get functions, which include functions such as GetField, GetRecord, and so on, generally provide access to data that already exists, whether in the data buffers or from an existing definition.

Create functions, which include functions such as CreateObject, CreateArray, CreateRecord, generally create defined objects that do not yet exist in the data buffer. Create functions create only a buffer structure. They do not populate it with data. For example, the following function returns a record object for a record that already exists in the component buffer:

&REC = GetRecord();

The following example creates a standalone record. However, there is no data in &REC2. The specified record definition must be created previously, but the record does not have to exist in either the component or data buffer:

&REC2 = CreateRecord(EMP_CHKLST_ITM); 

Explain Component Buffer

Component buffer is the area in memory that stores data for the currently active component. The component buffer consists of rows of buffer fields that hold data for the records associated with page controls, including primary scroll records, related display records, derived/work records, and Translate table records. PeopleCode can reference buffer fields associated with page controls and other buffer fields from the primary scroll record and related display records. 

How many records can you have in one scroll level?

Each scroll level can have only one primary scroll record, but can have related display records, derived/work records and Translate table buffer fields.

The primary record on a level one scroll area must be a child of the primary record on level zero, the primary record on a level two scroll area must be a child of the primary record on its enclosing level one scroll area, and the primary record on a level three scroll area must be a child of the primary record on its enclosing level two scroll area. 

What event is associated with a Page?

The only event for Peoplecode to be written on a Page = Activate Event (not supported by Sub-pages) 

How are external Peoplecode functions stored?

These are stored in FieldFormula event in the record with the prefix FUNCLIB_. Internet scripts are stored as WEBLIB_. To use a function in a program, it must be declared at the top of the program.

Explain difference between Assignment by Value and Assignment by Reference

  • Assignment by Value = the result of the right-hand expression is assigned to the variable as a newly created value, in its own allocated memory area
  • Assignment by Reference = When both sides of an assignment statement are object variables, the result of the assignment is not a copy of the object. You’re making a copy of the reference only. The variable names do not refer to separate and distinct objects; they both refer to the same object. Variables are passed by Reference to functions.

Which are the Think-Time functions in PeopleSoft?

Think-time functions suspend processing either until the user has taken some action (such as clicking a button in a message box) or until an external process has run to completion (for example, a remote process). 

Call to external DLL, DoCancel, DoModal, InsertImage, AttachFile, RemoteCall., RevalidatePassword., WinExec (think-time only when synchronous), WinMessage,  MessageBox (depending on the style parameter) etc.

Which event is triggered when we click a button on a page in PeopleSoft?

PeopleCode programs started by button are placed in the FieldChange event.  

In which events, we should not write any error or warning?

Errors and warnings should not be used in FieldDefault, FieldFormula, RowInit, FieldChange, RowInsert, SavePreChange, WorkFlow, and SavePostChange PeopleCode events. An error or warning in these events causes a runtime error that forces cancellation of the component.

Which function is used to force Save on a page?

DoSave()

 How can we place the focus on the field that caused the error or warning condition on an Error or Warning function in SaveEdit within the current component?

Use the SetCursorPos to place the focus in a specific field anywhere in the current component.

Related Posts Plugin for WordPress, Blogger...

{ 0 comments… add one now }

Leave a Comment

Previous post:

Next post: