Sei sulla pagina 1di 69

APPLICATION DESIGNER:

What are the 8 Development Steps?


8 steps in Developments steps: Design the Application, Create Field Definition , Create Record
Build the Record, Design the Page, Create Component, Register the Component, Test the Application
Translate Table? A translate table is a prompt table that serves as data dictionary to store values
for fields that dont need individual prompt tables of their own.
Limitations of Translate table? 3. Field values should be small (static).
1. Field type should be character 2. Minimum Field length should be 1 to 4 characters.
What is a prompt table? Prompt tables are the most common methods for validating data entry in ps applications.
This is like application data table the only difference is that it stores values that other tables can validate against. Prompt table is a
control table. (Country table and Company table)
How many table edits are there in Record field properties?
1. Prompt Table With Edit 2. Prompt Table No Edit 3. Translate Table 4. Yes/No Table Edit
Prompt Table No Edit: Provides List of Suggested values, which users cannot edit.
Prompt Table With Edit: Users can edit the contents of the field against the values that are maintained in the specified prompt Table.
Translate Table Edit: Which is nothing but a translate table created by developer.
Yes/No Table : I need some situations we want the user to enter only Boolean values like yes or no, true or false in this situation we
will use yes no table. What is a record? A record definition is a definition of what your underlying SQL
database tables will look like,and how they will process data.
What are the 3 build options available when building a table from a record?
Build script file: which generates a sql script that can be run against the desired database to build the table.
Execute SQL: which builds the table in the database. Execute and build script: which both Build the table and generates a SQL script.
How many types of tables are there? Define them?
SQL Table: A physical SQL Table present in the database, this is the default.
SQL View: Not a physical SQL Table but corresponds to a view written in SQL referring one or more fields from different tables. This gives a
filtered view of information stored in tables. Stored in the database as a view. (Query view is system generated and SQL views are created by
developer) whenever you modify a record you need to take care: check if any views are dependent on this record.
Dynamic view: A record definition that can be used like a view in pages and People Code but is not stored as a SQL view in the
database. Dynamic views provide superior performance.
Query View: using the PeopleSoft Query we dont need to write a query it will automatically generate by dragging and
dropping. This is a two tier tool and runs through application designer and produces SQL dependent upon the host RDBMS.
Derived/Work: We can use it to calculations. It is not an object, and also we can use it as a funclib. A temporary workspace to
use during online page processing. A derived or work record is not stored in the database, so no need to build it.
A derived / work field may be used to store and display a calculated value on a panel or to pass a value from
one People Code program to another.
Sub Record: Group of fields used in multiple records like companies having address data of employees. If you have to use the
same fields in different record definitions, then we will store all those fields in a subrecord and add this subrecord as a field to
the record definitions. Stored in the database.
Temporary Table: we will do all the manipulations on the data present in the temporary table. Increases the performance, as it
is not stored in the database. Used mainly for the AE batch processes.
Dynamic view? Where we can use dynamic View? It can be used like a view in pages and people code but not stored in
database as a sql view, instead the system uses the view text as a base for the sql select that is performed at runtime. Dynamic views
shows superior performance in some situations such as search records and people code selects.
Difference between Query Views & Dynamic Views?
1. Query Views are designed using Query Manager Tool where as we write SQL in Dynamic Views.
2. Query View is Built and Exists in the Database where as Dynamic View cant be build so it doesnt exists in Database.
Diff: SQL View and Dynamic View?
SQL views are written against the RDBMS catalog tables. Dynamic view is declared only to p.tools and not to the system catalog.
SQL views r not recommended for performance tuning as they run against the database. Dynamic views improve performance. SQL
views reside in the Db, dynamic views are not.
Difference b/n primary record and the search record?
All fields in a scroll area or grid must be associated with one (and only one) record, which is the primary record for that
level. The search record builds the search page for a component and populates all fields at level 0.
Subrecord? A SubRecord by definition allows you to add a group of fields that are commonly used in multiple record
definitions. A SubRecord must be defined before it can be entered into a record definition. Insert - SubRecord
What are Sub panels? If you have groups of controls, such as address controls, that you use on multiple panel
definitions, you can save it as a subpanel. And insert this sub panel wherever you want.
What are Secondary panels? Secondary panels are used to gather or display information related to the objects that
appear in a primary panel. A secondary panel can be called from the primary panel and used to enter
or display additional data without cluttering your primary panel.
RowSet is data structure representing the hierarchical data, RowSet consists of set of rows, where Each Row
consists of set of records and child RowSets. Used this Rowset object to retrieve the data from component buffer.
Difference b/n standard, secondary and subpage? Take any page PRESS Ctl J
Standard page: It is the graphical interface between users and database. The important data is displayed in the standard page.
We can place secondary as well as a subpage in standard page.
Secondary Page: Page that will open on users request but remains as a secondary to the primary page display. We can open it
through standard page only.
The data within secondary page is at the same level or below the level of the page control that launches the secondary page.
Subpage: subpage controls are used to provide standard look for the commonly used fields. A sub page is referenced as a page
control on multiple standard pages.
How to invoke the secondary panel? There are 2 ways:
y Insert a PB control type of Secondary Panel. This automatically invokes the secondary panel when the user presses the PB.
y Insert a secondary panel control. This is invisible at run time. When you use a secondary panel control, u must also insert a
command PB on the panel and call the DO MODAL Pcode function from the PB's FieldChange event in order to invoke the
secondary panel. Difference between subpage and sub record
All the fields in a subpage must be associated with fields of a sub record in the specified record definition.
Subrecord contains all related fields, whereas subpage contains fields from sub record.
What is occur level and occur count?
Occurs Level: Occurs level determines the level of the object that we inserted. By using this we can set levels for example
after inserting a level based control in level 2 if you want to change the level based control to level 1,U can change the occurs level.
Occur Count: Occur Count determines how many rows should be displayed.
For ex if you want the scroll to display only 5 rows then we will give occurs count to 5.
What is a Related Display field and Display Control field?
A related display field is for display purposes only - it always references a row that's not being updated from the
current panel. The display control when you select Related Display field, you need to relate it to the appropriate
control. A list of all the controls on the panel marked as display control fields in the Related control field box. Select
the control field to Which this particular related display is related.
Scroll Area? SA Is a Page Control which contains Child Records-Fields which is used to maintain the Parent-
Child Relationship between Tables. We can place any number of scroll areas on a page.
What are Level Based Controls and their Difference? Level Based controls are Scroll Area, Grid and Scroll Bar.
Scroll areas have their page fields arranged by the developer. Page fields in a gird always appear in a single row. In
grid we can view no of rows by giving occurrences. Scroll areas provide a row separator when you select multiple
occurrences of data. We can view multiple rows in a grid while in a scroll area you can retrieve only one row at a
time. One can have nested scroll areas but not grids. You can insert grid in a scroll area but not scroll in a grid.
What is Parent Child Relationship? To maintain parent child relationship if the parent table contains one key
field the child table should contain the same key field and one additional key.
Conditions are: 3) we can not go for more than three levels of parent/child relationships.
1) The child record should have all the key fields of parent record and at least one more key field other than the key fields of parent record.
2) We should mention the parent record in the record properties of child record.
Advantages are: 1) To have referential integrity. 2) No need to enter information again and again
What is the difference between scroll area and Grid? I used in Employee and Employee dependent details
Scroll areas single row of data will be displayed whereas in grid multiple rows of data will be available.
Yes I used scrollAreas, 4 Levels of scroll areas are in Peoplesoft, and they are level0, level 1, level 2, level 3, level 4
How many levels can we have on a page? Page allows Nested levels up to 3 levels.
Component Buffer? Area in memory, which stores data for the currently active component. Whenever
you open a component the entire data for that component is retrieved upfront and stored in the
application server. Component buffer is a temporary buffer allocation.
Component processor? It is a peopletool runtime engine that controls the processing of the application.
Data buffer? Data buffer contains multiple components of data.
Difference between component buffer and data buffer? Component buffer contains active component
data i.e. level 0 data. Data buffer contains multiple components of data.

What data comes into Component Buffer?
Primary record data, related display fields, translate values and derived work records. If you keep key and alternate search key
on 0 level then only 2 values will appear in Component Buffer the other field values will not available. In Component Buffer if
you want to see the other field values then place a non-key field on 0 level and make it invisible. Every level will have its own
primary record. A level 0 primary record and a search record can be different but the key field values should match.
What is registering a Component? We will add the component to a Menu and give permissions and security.
What is Business Unit? What are the major functions? It performs 2major functions : 1),2)..
A business unit is a way of tracking specific business information for reporting and other roll-up data collection.
1) It allows you to maintain a tree structure to facilitate customer-specific roll-up reporting.
2) It allows you to distribute and administer certain control tables like the department table.
This is extremely important for large or multinational companies.
What is Setid? Keys to linking business units to record control groups. It is the key on all control tables in TableSet
sharing every row in a control table includes a setid as its key.
SetIDs partition the data into groups or sets of data that are appropriate for each Business Unit.
What is Table Sharing? It is a method of filtering prompt data so that only appropriate values are available for data entry.
With TableSet sharing, a single table can offer different values based on underlying business rules. Table set Sharing is organized
around these basic elements:Business Units and transaction tables, SetIDs and control tables, Business rules.
Record group consists of records with similar functionality. To setup a record in record group we should enter a set control field value in
record properties
Difference b/n a Business Unit and a Set Id? Its a way of organizing your data in the system.
A BU is a way of tracking and reporting specific business information for reporting and other roll up data collection. It
does not have to be a legal entity for HR. Its a way of organizing your organization.
A SetID is a link to Table Set Sharing. Table set sharing simply consists of assigning specific SetIDs to specific
record groups for individual Business Units to restrict the view of rows of data within Control Tables.
Joins: Inner join: Matches key fields & gets the common part in the case of Inner join.
LOJ (Left-outer join): Matches key fields, and gets common data as well as additional data in left table.
ROJ: Matches key fields, and gets common data as well as additional data in rightt table.(we cant perform this in ps)
Self join(SJ): Joining same table is called self join.
SUB Query: the output of one SELECT statement acts as an InPut for another SELECT statements.
About Views: A view is a database object that is a logical representation of a table. It is derived from a table but has no storage of its own and
often may be used in the same manner as a table. Creating a view:
Create view INVASION AS Select WEATHER .City, Condition, Temperature, Latitude, NorthSouth, longitude, EastWest
From Weather, location, Where WEATHER.City = LOCATION.City; Search views are used for three main reasons.
1. Adding criteria to the search dialogue page 2. Providing row level security. 3. Implementing search page processing.
Advantages of Using Search Views instead of Search Table: As the search view is created with selected fields there will not be
much stress on app server and there by improves the performance. Search View also gives additional search criteria.
In PIA (?) End users do not have any peoplesoft specific software installed on their machines, they use Internet browser to connect web
server, which interacts with application server.

What are the 3- Actions that can be attached to Menu? -Component -Separator -PeopleCode
Deffered and Interactive Processing
In Interactive mode for every cursor action there will be a trip to the server. In deferred processing mode, trips to the server are
reduced. In Interactive whenever a user exits a field there will be a trip to the server.
In Differed processing until a user performs an action, which requires a trip to the server there wont be any trips to the application
server. In how many places we can set Differed processing? Field,Record,Page,Component









The Effective Date:
- Allows us to maintain history, current and future information.
- Represents the date that the specific data change goes into effect.
- Enables us to maintain a complete chronological history of all records.
- Works as a cross-reference, as the system constantly compares the effective dates to information
stored in other tables. This ensures that data you select from PeopleSoft is valid as of the desired
effective date.
Effective date? Date on which a table row becomes effective, the date that an action begins.
Ex: if you want to close out a ledger on June 30, the EFFDT for the ledger closing would be July 1.
This date also determines when you can view and change the information. Pages or panels and batch processes that use the
information use the current row. Effective date enables us to keep historical, current, and future information in tables. There
are 3 types of effective dates: Current, History and Future.
Past date - Within 30 days of current date is called past date. History date - Above 30 days of current date is called History Date.
Effective status? EFF_STATUS usually accompanies EFFDT.
Ex: in Department table suppose we inactivated one dept from so and so future effdt, from that future date onwards this dept
is going to be inactivated, after that whenever we click the link prompt button of dept id field we can see only active departments.
Effective sequence? Whenever we want to enter more than one transaction on the same day for an Employee
like promotion and salary hike we will use effective sequence. Effseq number starts with 0
Use of EffSequence. same day different action will be performed so Effetivedate , date will be same so to
differentiate from other we need a sequence of order so it shows the order of occurrence. Which is used to maintain
different row for the same key value & same Effective Date. The search record is determined at the component level.
SELECT A.EMPLID FROM PS_JOB A WHERE A.EMPLID = '12345'
AND A.EFFDT = (SELECT MAX(A_ED.EFFDT) FROM PS_JOB A_ED WHERE A.EMPLID = A_ED.EMPLID AND A.EMPL_RCD = A_ED.EMPL_RCD AND A_ED.EFFDT <= GETDATE())
AND A.EFFSEQ = (SELECT MAX(A_ES.EFFSEQ) FROM PS_JOB A_ES WHERE A.EMPLID = A_ES.EMPLID AND A.EMPL_RCD = A_ES.EMPL_RCD AND A.EFFDT = A_ES.EFFDT)










(CI) Component Interface is used to access Cmpt from external clients (Third Party Applications)
including all business rules and data without going through the ps client. To expose cmpt (methods and properties) to the
external software (ex: vb, c, c++, java, com, dcom etc). Fundamental elements in the CI architecture: components, CIs, CI API.
3) How do you provide security for the component interface?
y Open the Permission list y On the Component Interface tab y Add row and select the newly created Component Interface
y Edit the permissions to give permission for the standard methods y Get, Create, Save, cancel, find.
ATTRIBUTES of the Component Interface? and different keys in CI? 1. CI name.
2.Keys (get keys, create keys, and find keys). 3. Properties and collections (fields and records),4. Methods (Save, Cancel...).
Get keys are nothing but search key of the component search record, We cannot change the get keys.
Find keys are based on search key and alternate search keys of the search record. We can remove find keys if we dont want to use
Create keys are based on the add search record keys (add mode) and generated automatically for the component
interface. We cannot change the create keys. Create key are generated only when the CMPT is in Add action only.

Properties: Properties are individual fields in component for CI. (Standard properties exists for every CI)
***Properties are 2 types Standard properties, User defined properties
Createkeyinfocollection Developer Can Further Control The Exposed
Getkeyinfocollection field properties. Findkeyinfocollection Property Info collection
GetHistoryItems (Update/Display mode or Correction mode) EditHistory Items InteractiveMode.
Collections are referred as scrolls(level based controls will be having a primary rec) in the component for C.Interface.
CreateKeyInfoCollection: Returns a set of items that describes the create keys.
GetKeyInfoCollection: Returns a set of items that describes the get keys
FindKeyInfoCollection: Returns a set of items that describes the find keys
PropertyInfoCollection: Returns a set of items that describes properties.
How do you login in Correction Mode in the Component Interface?
Get History Items and Edit History items property to should be set to true. Get History Items alone: - Update display all - modes will be used.

Methods? How many Methods are there? A method is an object that performs a very specific function on a component
interface at run-time. There r 2 types of methods are there: Standard methods and user-defined methods.
The event of a CI is methods (like On Execute for AE.)
Standard methods: - Automatically generated upon the creation of a new CI in Application.
Apart from the Standard methods there are Standard methods available for the use with any collection.
User-Defined methods: - User-defined methods are those that you can create to meet the requirements of an individual CI.
Can we map more than one component at a time from the CI? NO
Can we create the get keys and find keys manually? No, created based on the search record definition for the underlying component.
Types of properties can include the CI? Standard properties User-Defined Properties
What are the standard properties? Interactive Mode GetHistoryItems EditHistoryItems.
Can we create the user-defined methods? Yes. We can create user-defined methods after creating a CI.

Why should we write in save post change only, why not in other event?
Because CI object data will not be in component buffer and student information component data will not be in
component buffer so we are updating/inserting the data in the data base not in the component buffer tables.
Whenever we create a CI, we will give a name to CI to access.
Catching Error Message in the CI? Or Use of PSMessages in the CI?
This function needs to be called when ever methods like Find, Save, Create methods return false.
Error text and Error type can be printed in the log message for any other action in to the log message.
Function CheckErrorCodes()
&PSMessages = &Session.PSMessages; &ErrorCount = &PSMessages.Count;
For &i = 1 To &ErrorCount
&ErrorText = &PSMessages.Item (&i).Text; &ErrorType = &PSMessages.Item(&i).Type;
End-For; End-Function;




The following are various steps that describes the peoplecode logic while implementing a Component Interface
1.Establish a user session 2.Get the Component Interface 3.pulate the Create Keys 4.Create an Instance of the CI
5.pulate the required fields 6. Save the CI

2) If you are PS developer then In what scenarios Component Interface will have advantages over component?
A component exposes your pages to peoplesoft only. Moreover it helps us to define common properties for a set of related
pages.
A component interface is a set of application programming interfaces (APIs) that you can use to access and modify PeopleSoft database
information programmatically. PeopleSoft Component Interfaces expose a PeopleSoft component (a set of pages grouped for a business
purpose) for synchronous access from another application (PeopleCode, Java, C/C++, or Component Object Model [COM]).
4) What the steps that you need to do in people code to invoke Component Interface?
y Establish a user section y Get the component interface definition y Populate the create keys
y Create an instance of the component interface y Populate the required fields y Save the CI.
&Session = GetSession(); &CI = &Session.GetcompIntfc(CompIntfc.INTERFACE_NAME)
&CI.KEY_FILED_NAME = NEW
If not &CI.Create () Then
Else Populate other fields End-if;
Populate the other fields
If not &CI.Save () Then Else End-if;
How do you test Component Interface? y Using the CI tester y Give values in the tester for options
y Get Existing, Create new, Find and perform the operation from the CI Tester

Catching error message in the CI? Or Use of PSMessages in the CI ?
This function needs to be called when ever methods like Find, Save, Create methods return false.
Error text and Error type can be printed in the log message for any other action in to the log message.

Function CheckErrorCodes() &PSMessages = &Session.PSMessages; &ErrorCount = &PSMessages.Count;
For &i = 1 To &ErrorCount
&ErrorText = &PSMessages.Item(&i).Text; &ErrorType = &PSMessages.Item(&i).Type; End-For; End-Function;


Traversing the Collections in the CI?
COLL_JOB Collection Coll_JOBItm Row in the collection.
&COLL_JOBCol = &CI_JOB_DATA.COLL_JOB;
For &i = 1 to &COLL_JOBCol.Count
&COLL_JOBItm = &COLL_JOBCol.Item (&i);
&COLL_JOB_JRCol = &COLL_JOBItm.COLL_JOB_JR;
For &J = 1 to &COLL_JOB_JRCol.Count
&COLL_JOB_JRItm = &COLL_JOB_JRCol.Item (&j);
&COLL_JOB_JRItm.KEYPROP_EFFDT =;
How can a component have more than one search record? Give a situation.
You might want to reuse the same component multiple times with different search records. You can accomplish this by
overriding the component search record at runtime when the component is opened from a menu item without creating
separate copies of the component. The component override is temporary, and occurs only when the component is opened
from the menu item in which the override is set. It does not change the component definition.










SECURITY
Implement security in PS in 6 ways:
Signon and time-out, Page and dialog, Batch environment,Definition security, Application data, PIA

Permission List(PL) is a list of authorizations that we assign to roles.
PL stores the Sign-On times, Menus, PeopleTool access, such as access to App Designer.
A Role is an intermediate object that links the user profiles to the permission lists.
Roles enable you to add permissions to users dynamically. . .. Navigation, on Portal
PeopleTools, Security, Permission & Roles, Permission List, PeopleTools, Security, Permission & Roles, Roles.
PeopleTools, Security, User Profiles, User Profiles. AD: Go, Definition Security in Application Designer.

Single sign on? At a time we connect to more than one database. Means if we are in HR database, after
completion of the transactions if we want to enter into FIN database, for this we need not reenter the password.
Sign on time? Is an adjustable interval during which a user is allowed to sign on to PS.
Using Maintain Security we can specify both the sign on times and time-out interval.

Is it possible to restrict some users to access specific actions? YES
User ID is an ID which we enter at the PS sign on dialog box, User ID stored within an LDAP directory server.
Connect Id we can connect to the Database. Create the Connect IDs, by running the Connect.SQL and Grant.SQL scripts
Connect ID means we don't have to create a new database user for every PS user that we add to the system.
Specify the Connect ID for an AS in the Signon section of the PSADMIN utility, and for Windows Clients

we specify the Connect ID in the Startup tab of the Config. Manager.
We use Symbolic ID as a search key for retrieving the encrypted value of Access ID, which is stored in PSACCESSPRFL.
Also, the Symbolic ID acts as an intermediary entity between the User ID and the Access ID. All the User IDs are
associated with a Symbolic ID, which in turn are associated with an Access ID.
For example if we had to change the Access ID, then we need to update only the reference of the Access ID to Symbolic ID in
the PSACCESSPRFL table rather than updating with each and every User Profile in the PSOPRDEFN table.
While creating a User ID, we will assign an Access Profile to the user id, which specifies an Access ID and password.
PeopleSoft Access ID is the RDBMS ID with which PeopleSoft applications are ultimately connected to the database after the
PeopleSoft system connects using the Connect ID and validates the User ID and password. An Access ID typically has
administrator-level database access; that is, it has all the RDBMS privileges necessary to access and manipulate data for an
entire PeopleSoft application. The Access ID should have SELECT, UPDATE, and DELETE access.
It's important to understand that users do not know their corresponding Access ID. They just signon with their User ID and
password andbehind the scenesthe system logs them onto the database using the Access ID.
Should they try to access the database directly with a query tool using their User or Connect ID, they have limited access. User
and Connect IDs only have access to the few PeopleSoft tables used during signon, and that access is SELECT-level only.
Furthermore, PeopleSoft encrypts all sensitive data that resides in those tables.
Access groups are nodes in a query tree, which are built with PS Tree Manger. Users access to one or more of its
access groups. Then they can generate queries on any tables in the access groups accessible to them.
Open the desired Permission List and select Query, Access Groups Permissions. Select a Tree Name.
Select the highest Access Group that the user can access.
Users can run only those processes through Process Scheduler that belong to process groups assigned to their
role. Process groups are collections of Process Definitions that we create using PS Process Scheduler. Add process
groups to permission lists on the Process Group Permission page.
Process profile definition (defined in Process Scheduler) determines the default Process Scheduler settings for a user.
Data permissions, or row-level security, appear either through a Primary PL or a Row Security PL.

W.S/A.S security controls access to system objects and resources, So that only authorized users can connect to a given
database. Database security controls the access to database tables.



At what level we can setup the PeopleSoft application security? (User Level Row-Level Field-Level Object level)
User Level security? By using the Maintain security PeopleTool we can establish the user security. Using
the User Security we can controls the user access into PS applications.
Row-Level Security? use? Row-Level Security is implemented by using the SQL Views.
Using the Row-Level Security we can controls the rows of data that can be accessed by each user.
Field-Level security? use? By assigning the PeopleCode to the field. Like Hide Unhide, Gray, Ungray.
Using the Field-Level security we can control the user access to specific data field.

How can we establish the Object Security? By using the Definition Security PeopleTool.
Purpose of the Definition Security? Using , we can restrict particular objects from application developers. But not for the end users.
Can we run the Definition Security in Browser environment? No. it is applicable only in windows ET.
How many objects we can develop using the Definition Security? Only one objects that is Group ID.
AD: Go, Definition Security in Application Designer.
File, New Group (Here we can specify all the objects which we want give the permission to access the user). After
creating new groups if we want to modify the group then go to File, Open, Group Then specify the Group Id. File,
save (save the new group). File, Open, Permission List. Then specify the PL. Then assign groups to the PL. Then Save.

PIA Security is in the category of PS online security, also known as runtime security.
Only authorized users can connect to the web and application server, and only authorized application servers
can connect to a given database.

Diff: Maintain security and Object/ Definition Security? By using the Maintain Security we can restricts
the users to access the particular functions like some pages, some records,..
but using the Object security we restrict the total objects.
Ex: if we don't want a developer to touch AE programs, don't allow them to access AE.

What is Batch Environment Security? or How do you give security to batch programs like SQR and A.E?
There are three levels of security for batch programs:
Each batch program has a run control that we define before we can run the batch program.
The run controls are set up using PS Process Scheduler.
Also using PS Process Scheduler, you set up Process Groups, which are groups of batch processes.
Then in PeopleTools Security ,you add Process Groups to a security profile. Users can run processes that belong to the
Process Groups assigned to their security profile.
In your RDBMS environment, you can restrict off-line access to batch processes using the security tools described in
your platform manuals.
Note: Add the Process Profile Permission List directly to the User Profile, not to an intermediary Role.

Row Level Security? With row-level security, users can have access to a table without having access to all rows on that
table. This type of security is typically applied to tables that hold sensitive data.
People Soft applications implement row-level security by using a SQL view that joins the data table with an authorization table.
How to implement Row Level Security by operator id? You can design special types of sql views security
views to control access to individual rows of data stored within your application database tables. peoplesoft
applications are delivered with built-in row level security functions, tailored to the specific application.







Define Workflow? Workflow enables to efficiently automate flow of time-consuming business processes and deliver
the right information to the right people at the right time throughout enterprise. You can merge the activities of multiple users into
flexible business processes to increase efficiency, cut costs, and keep up with rapidly changing customer and competitive challenges.
For example, when you order supplies, you are really initiating an approval process: someone else reviews the order and either
approves or denies it. If the order is approved, a purchase order is sent to the vendor. If it is denied, notification is sent back to the
person who submitted the original order. The term workflow refers to this larger process.
Work Flow: Appropriate values might include the key data for the record in which the Item will be worked.
For example, for a work item directing a manager to Approve an expense report, the text might be the name of the employee who
Submitted the report.
worklist_descr - a text comment that appears in the users worklist. the presence of this field automatically suppresses the
display of any application fields, although the key fields are still used to bypass the search page of the target page.
2. What is a worklist record? Worklist record is the record that is used in workflow. Its structure is predefined Having 6
required fields. :System fields: The first fields in a worklist record definition must always be the Following system fields.
Busprocname - the business process that includes the work item.
Activityname - the activity that triggers the worklist routing. Eventname - the business event that triggers the worklist routing.
Worklistname - the worklist in which the work item is waiting. Instanceid -the system-assigned id for the work item.
Transactionid -the system-assigned transaction id for the work item. when an event triggers multiple routings, each work item
has the same transactionid, but a different instance id
Application fields and Worklist display fields :
The last two fields in a worklist record definition are for descriptive information that appears in the worklist.
worklist_url -the text that links to the page where the user can work on the item. Appropriate values might
include the key data for the record in which the item will be worked. For example, for a work item directing a
manager to approve an expense report, the text might be the name of the employee who submitted the report.
worklist_descr - a text comment that appears in the users worklist. the presence of this field automatically suppresses the
display of any application fields, although the key fields are still used to bypass the search page of the target page.
1. Steps involved in Workflow?
- Designing a Workflow Application -Analyze and document business requirements. -Diagram the process flow.
- Document the workflow object attributes for business processes, activities, steps, events, and email and worklist routings.
1. Build Supporting Definitions
- Create Workflow Maps -Create the workflow maps comprising the steps, activities, and business
processes required for your workflow as determined in step one.
- Define Roles and Role Users -Define the roles and the role users, including any Query roles, required for your workflow.
2. Define Worklist Records
- Create a record definition that will be used to store all of the application-specific information for the worklist.
- Define the Workflow Objects -This is the step in which you define the workflow application. You enter
each of the objects onto a business process definition in Application Designer as determined in step one.
- Define Event Triggers -Define the business rule in PeopleCode on the triggering application record definition.
Workflow programs are defined on a record definition for one of the tables that the component accesses.
They contain the business rules used to decide whether to trigger the business event. The PCode detects when a business rule
has been triggered and determines the appropriate action.
- Test -Test your workflow, or use the workflow monitoring tools in Workflow Administrator to validate worklist routing results.
2. Rules, Roles, Routings?
- Rules determine which activities are required to process your business data. For example, you might implement a rule that says
department managers must approve all requests for external classes. You implement rules through workflow events, such as
PeopleCode that evaluates a condition and triggers a notification (a routing) when appropriate.
- Roles describe how people fit into the workflow. A role is a class of users who perform the same type of work, such as clerks or
managers. Your business rules typically specify which roles do which activities. For example, a rule can say that department
managers (a role) must approve external course requests EX: User list roles, Query Roles.
- Routings specify where the information goes and what form it takes: email message or worklist entry. Routings make it
possible to deploy applications throughout the enterprise. They work through the levels and departments of an enterprise to bring
together all of the roles that are necessary to complete complex tasks.
3. Events, Workflow Peoplecode, Approvals
Events are conditions that have associated routings. Define the condition in PeopleCode, which is attached to the record definition
underlying a step in a step map. When a user saves the page, completing the step, the system runs the PeopleCode program to
test the condition. If the condition is met, the system performs the routings.
To trigger a business event from a page, you add a PeopleCode program to the workflow event in the record definition for one
of the tables to which the page writes.
Approval processes are a common form of business process. The approval steps that you place on the approval rule set map
represent the approval levels that are required for the activity.






What is PIA Architecture? In PIA end users do not have any peoplesoft specific software installed on their
machines, they use Internet browser to connect web server, which interacts with application server.
What are components of PIA? Web browser, Web server, App. server, Batch server, Database server
What are major tasks that the Application Server performs in PIA?
The AS maintains a persistent connection to the database, and converts peopletools and application table data into HTML. The
server then provides the HTML to the WS for delivery to the browser.
The AS also plays a role in connecting development workstations to the database for three-tier connections.
What are the major tasks performed by the Web Server in PIA?
Web server acts as the front end of the PIA.
The Web server includes Web services software that displays the HTML to the browser. It also includes java servlets that
manage each sessions connection to the application server.
What is Tuxedo/Jolt? Tuxedo manages the multiple connections to the database.
Jolt is a java based communication protocol. The assembled HTML is sent to the web server.
What are the different types of tables in PeopleSoft and give one example of each?
1) System catalog tables - SYSOBJECTS, SYSCOLUMNS 2) People Tools Tables - PSRECDEFN, PSPNLDEFN
3) Application Tables - PS_STUDENT_DATA, PS_CUSTOMER_TBL//// (PSDB Structure Is this way only.)

Important Tables in HRMS?
PS_PERSONALDATA, PS_PERS_NID, PS_EMPLOYMENT, PS_JOB, PS_JOB_TBL, PS_DEPT_TBL, PS_LOCATION_TBL,
PS_FED_TAX_DATA, PS_STATE_TAX_DATA, PS_LOCAL_TAX_DATA,

PS_BEN_PROG_PRATIC, PS_HEALTH_BEN, PS_LEAVE_PLANS, PS_LIFE_BEN, PS_RTRMNT_PLN,

PS_PAY_CHECK, PS_PAY_LINE, PS_PAY_BONUS, PS_PAY_DEDUCTIONS, PS_POSITION_DATA.












































Why do you use DM? Data Mover .enables you to perform the following tasks:
Transfer application data between PeopleSoft databases. Move PS databases across operating systems and database platforms.
Execute SQL statements against any PeopleSoft database, regardless of the underlying operating system or database platform.
Control database security and access.
Create, edit, and run scripts. These scripts may include any combination of SQL commands and Data Mover commands for
exporting and importing data.
What are the different modes in DataMover?
Regular Mode Most of the time you will sign onto PeopleSoft Data Mover in regular mode. To do this, you simply enter
your PeopleSoft user ID and password at the sign on screen. In regular mode, all commands are valid.
Bootstrap Mode At times, you need to signon on to PeopleSoft Data Mover in bootstrap mode, which
means using the database access ID and password at the signon screen.
Typically, using bootstrap mode is necessary for database loading because there are no PS security tables established
yet. Bootstrap mode is also used for running some security commands, such as, ENCRYPT_PASSWORD.
Explain about - Data Mover? PeopleSoft Data Mover is a stand-alone two-tier program, which you can run through a graphical
interface on Microsoft Windows, or a with a command line interface on either Microsoft Windows or UNIX systems.
PeopleSoft Data Mover enables you to perform the following tasks:
- Transfer application data between PeopleSoft databases.
- Move PeopleSoft databases across operating systems and database platforms.
- Execute Structured Query Language (SQL) statements against any PeopleSoft database,
regardless of the underlying operating system or database platform.
- Export data in a platform independent manner.
- Control database security and access.
- Create, edit, and run scripts which combine SQL commands and PeopleSoft Data Mover commands for
exporting and importing data.
What are Data Mover operating modes?
-Regular Mode: Using PeopleSoft User Id, -Bootstrap Mode: Using Database access Id
Commands in Data Mover?
- ENCRYPT_PASSWORD: Encrypt one or all user passwords (operator and access) defined in PSOPRDEFN for users.
- EXPORT: Select record information and data from records and store the result set in a file.
You can use the generated export file as input for migrating to another platform.
- IMPORT: Insert data into tables using the information in an export file. If a tablespace or table does not exist,
this command creates tablespace, table, and indexes for the record, using the information in the export file,
and inserts the data.
- REM: For Remarks -RENAME: Rename a PeopleSoft record, a field in one record, or a field in all records.
- REPLACE_ALL: This is a variation of the IMPORT command. If a table already exists, use this command to
drop the table and its indexes from the database and create the table and indexes using the information in the
export file. Then, the command inserts data into the table using the information in the export file.
- REPLACE_DATA: This is a variation of the IMPORT command. Delete data in existing tables and insert the
corresponding data from the export file.
- REPLACE_VIEW: Recreate specified views found in the database.
- RUN: Run a specified .DMS file from within a PeopleSoft Data Mover script. The file cannot contain nested RUN
commands.
- SET: When a command is followed by valid SET parameters, it forms a statement that establishes the
conditions under which PeopleSoft Data Mover runs the PeopleSoft Data Mover and SQL commands that follow.
- SET IGNORE_ERRORS: If this command is set, then all errors produced by the SWAP_BASE_LANGUAGE
command are ignored. Otherwise, the system stops on errors.
Sample Data Mover code? -set output c:\temp\position_data.dat; set log c:\temp\position_logfile.txt;
export position_data where location in ('11490', '11730','11804','11720') and position_nbr not in
('00002025','00002026','00002027','00002029','00002030','00002031','00002032');
-set input c:\temp\position_data.dat; - set log c:\temp\position_inputlogfile.txt; - import *;

The PeopleSoft System resides in a relational database. A relational database consists of a series of tables that are related to at least one other
table by key fields. The PeopleSoft application store information in two types of tables transaction tables and control tables.
You will need to understand how transaction and control tables work to effectively use the PeopleSoft application.
In this topic, you will learn:
1. What is a transaction table 2. What is a control table 3. How you use transaction and control tables
Information in transaction tables is organized and stored by Business Unit. A Business Unit at the UNDP organization, is one of the various
agencies or country offices such as UNDP1 UN Development Programme, EGY10 Egypt and IND10 India.
Transaction tables store data about day-to-day activities. Because of this, these tables are updated frequently and can be quite large. The type
of transaction varies, such as invoices, paychecks, employee names and addresses, job history, benefits data.
Most field users will only be entering records into transaction tables. When you create an invoice, hire employee or update proposal
information, you will be entering records into the respective Invoice, Employee and Proposal transaction tables.
Control tables defines the accounting structure and business rules that are used to process transactions in PeopleSoft. Control tables
are generally static; they change only when you perform specific maintenance, appropriate to your business processes, organization
structure or processing rules.
Control table information is organized and stored by a set identifier, commonly called a SetID. At UNDP, the default SetID is SHARE. Control
tables include pay groups, pay calendars, departments and job codes.
A TableSet is a subset of data within the control tales includes that defines the accounting structure and processing rules for a particular
business unit or group of business units.

Most control tables are maintained at the UNDP Headquarters, such as Business Unit, Benefit Plans, Job Code etc.
However, country offices and field users should still understand how a control table works since it defines the
accounting structure and business rules that are used to process transactions in PeopleSoft.








APPLICATION ENGINE
What is the difference between a Process and a Report? The Process receives a command line
parameter where as the Report receives run controls from the page.
What is the purpose of the Back Ground SQL Process?
We can validate the data. We can update Database.
We can move the data from one or more tables to one or more tables (Reporting Tables).
What is meant by Scheduling processing? Processing the data without user involvement.
What should we get when we open a new Application Engine program?
We can get only one section that is MAIN and Step01 (with no actions yet).
What is the purpose of the Program? An AE program identifies the set of processes to execute a given task.
What is Application Engine?
PSAE program is a set of SQL statements, PeopleCode, and program control actions that enable looping and conditional logic.
It is a Development People Tool designed to create applications, these applications are useful to perform the
(validate, move, update DB data) background SQL process, means we can develop, test, and run background SQL processing programs.
We can use PSAE for straight row-by-row processing, but the most efficient AE programs are written to perform set-based processing.
AE is designed for batch processing where we have a large amount of data that must be processed without user
intervention. Ex: calculating the salaries in payroll processing
PSAE.exe and It is written in standard C++.
And this file resides in c:\<PS_Home>\bin\Client\Winx86\PSAE.exe
AE includes two distinct components: one is the "front-end" used to define batch program and the other is "back-end used to
run the program what we developed.
Application Library? Application Library is program that contains collection of callable sections.
We cant run the Application Library as a standalone program.
How many levels of actions support the Application Engine program?
Application Engine supports up to 99 levels of nested Call Section Actions.
For example, the first called Section can call a second, which can call a third, and so on, up to 99 calls.
Program Types:
y Standard A normal entry-point program.
y Upgrade only Is used in PeopleSoft Upgrade utilities.
y Import only Is used by PeopleSoft Import utilities.
y Daemon only A special type of program used as a daemon process.
y Transform only Another special program type used to support XSLT.
What are the advantages with Application Engine over SQR and Cobol/SQL?
A.E is a People Tool Object. ..remaining are 3
rd
party tools.
1. Using A.E we can run parallel processing 2.The main advantage is restart facility.
2. Meta SQL support is there.
How many types of components can include the Application Engine?
Application Engine includes two distinct components: one is the "front-end" used to define batch program and
the other is "back-end used to run the program what we developed.
6. How can you integrate a wokflow to an AE PROGRAM?
Through CI. I.e. for running the Batch process we use AE and CI
AEPROGs trigger business events indirectly, by passing the results of their queries to the CI. If the component has associated
Workflow PeopleCode, a business process is triggered when the CI saves the page. (Or) The AEPROG runs a SQL query against
the PeopleSoft database and passes the results to a CI, which triggers Workflow PCode.
If an AEPROG returns multiple rows of datafor example, if it finds several overdue itemsthe agent passes the rows to the CI,
one row at a time.
Why do you use CI in AE? 1. To access the PS data associated with component by an external application i.e. (VB, JAVA,)
2. To run the Batch process
Improve performance of A.E. Program? By using temp tables we can improve performance.
By using traces and reusing options. Bulk insert option can speed up your program with in a loop.
Avoid using SQL execution logic in a people code action. Instead use the logic in Do Conditions.
Application Package is a set of classes.
In which events of people code we can write CallAppEngine function?
You need to include the CallAppEngine PeopleCode function within events that allow database updates.
This includes the following PeopleCode events:
1).SavePreChange (Record) SavePostChange (Page) 2).Workflow Subscription (Message) FieldChange.
There are different types of VARIABLEs in the AE people code?
Local variable these are available for the duration of the program in which they are declared.
Global / Component These variables are available while the Application Engine program is
running. They are saved at commits and checkpoints,
So they can be used for restarts. Component variables are same as Global incase of the AE.
What are the Different ways pass data between the steps?
1) State records One row can be passed and can have many state records.
2) Component/Global People code variables
3) Temporary records Multiple rows of data can be passed.

Can we have commits after every step? Yes we can have COMMIT after every step.
What is the sequence of execution of A.E. program actions?
Do When Do while Do select
SQL\ call section People code Log message Do until
Why call section and SQL are mutually exclusive?
Both SQL and call section is used to perform DML operations so we will use either SQL or call section.

What are the parameters of the steps?
Step Name: We can specify the Step name.
Step Description: We can write some description about the Step.
Commit After: We can determine when commit will be executed.
Default: uses value supplied for the section.
Later: dont commit now.
After step: commit when step completes.
Frequency: Only available in Loops.
On Error: We can specify any one action to take when an error occurs.
Abort: The program terminates and will write the message-to-message log.
Ignore: It will write message-to-message log and continue.
Suppress: no message will be written, but the program will continue.
Comment: We can add additional comments for this Step.
Error handling or Exception handling in Application Engine?
Step properties:-
On Error:-
Abort Write message to message log and terminate.
Ignore - Write message to message log and continue.
uppress No message will be written, but program will continue.
People code Action: - On return options can used to handle run time errors.
Abort: - Exits immediately Not recommended.
Break:- Exits the current step and section and control returns to the calling step.
Skip Step:- The program exits the current step, and continues processing at the next step in the
section. If this is the last step in the section, the calling step resumes control of the processing.
SQL Action properties:-
No Rows:- When the Sql doesnt return any rows, you can tell what application engine program
should do.
Abort: - Program terminates
Section Break: - Application Engine exits the current section immediately, and control returns to
the calling step.
Continue: - The program continues processing
Skip Step: - Application Engine exits the current step immediately and moves on to the next
step. When using skip step keep the following in mind:
1) Application Engine ignores the commit for the current step at runtime
2) If the current step contains only one Action, only use skip step at by-pass the commit.
Do While? It is a SELECT statement that runs before subsequent actions of the step. The subsequent actions
within the step are executed in a loop as long as the SELECT statement returns at least one row for the Do while
action. Do While is nothing but a While Loop.
DO until? A Do until action is a Select statement that runs after each action when a step completes. If the Select
returns any rows of data, the step terminates. Do Until is nothing but a Repeat Loop.
Do When? The Do When action is a SELECT statement that allows subsequent actions to be executed if any rows of data are
returned. This is the first executable statement with in the step. Do when nothing but an If Loop is. It contains SQL that tests for a
condition. If the condition is true then it returns a row of data, and it executes the subsequent actions within the step. If the
condition is false then no row of data returned and it terminates the entire step. If there are no more steps to execute, the program
will end.
SQL action?
SQL Statements are used to perform the DDL, DML, and DCL operations. Majority cases we are using the DML
commands (UPDATE, DELETE, INSERT, SELECT).
Call Section?
Call Section is used to call one section from another section. The "called" Section can be in the same program as
the calling Section, or it can be in an external program. If a Section already exists in one program, rather than
copying it into another program, just call it.
people code ?
People code provides reusing common faction libraries of A.E program. And used to build dynamic SQL performs
simple if /then/else edits set defaults and perform other tasks that dont required trip to the database.
Log Messages? A Log Message Action can be used to write a message to the MESSAGE_LOG based on a particular condition
in the program. This gives your program multi-language capability. The Message Log refers to the People Tools table
(PS_MESSAGE_LOG) where execution messages reside. Any substitution parameters are written to PS_MESSAGE_LOGPARM

difference between Do select and SQL? The Do Select action is a SELECT statement that executes subsequent
actions once for every row of data that the Do Select returns. It works like a FOR loop. It returns a row. Do Select
is a test condition. Where as SQL executes DML and Meta SQL.
Difference between Call Section action and Dynamic Call check box? Call Section is used to call one section
from another section. The "called" Section can be in the same program as the calling Section, or it can be in an external program. If
a Section already exists in one program, rather than copying it into another program, just call it.
Use the AE_APPLID and AE_SECTION fields in the state record to execute different sections
depending on the conditions a program encounters during runtime.
These two fields must be defined on the default state record for the program. If AE_APPLID is not present or is blank (at run time),
the current program is substituted for the AE_APPLID value. If AE_SECTION is not present or is blank, an error occurs.
When issuing a dynamic call, both the section and the Program ID must be dynamically set. You enable a dynamic call by first
having your program store different section names in the AE_SECTION field, and different program names in AE_APPLID field.
The values you insert in these fields are normally based on various conditions met within your program. You then create a
Call Section action that calls the section name defined in the State record field by selecting the Dynamic check box.
Selecting dynamic automatically populates the AE_SECTION field with the symbolic value %Section, and the Program ID field
with the symbolic value %AEAPPLID.
At runtime, the program calls the section name stored in AE_SECTION that belongs to the program name defined by AE_APPLID.
What is Call Section? What does dynamic attribute in Call Section do?
Call Section is an action which calls other sections.
It has attributes: Section Name/ Program ID/ Dynamic(Check Box)
When you want to call the section during run time you will check the dynamic.
We will keep two fields in the state record like AESECTIONNAME, AEPROGRAMID
So depending upon the condition the values are moved to parameters specified above.
How can we call a section dynamically in app engine?
Use the AE_APPLID and AE_SECTION fields in the state record to execute different sections depending on the
conditions a program encounters during runtime.
These two fields must be defined on the default state record for the program.
create a Call Section action that calls the section name defined in the State record field by selecting the Dynamic check box.
Selecting dynamic automatically populates the AE_SECTION field with the symbolic value %Section, and the Program ID field
with the symbolic value %AEAPPLID.
At runtime, the program calls the section name stored in AE_SECTION that belongs to the program name defined by AE_APPLID.
What are different types Do Select? 1) Select/Fetch 2) Reselect 3) Restart able
Select/Fetch: - Opens the cursor only at the first time and retrieve rows one at loop.
Commits inside the step (commits in the Called Section) are ignored if AE is Restart enabled.
Reselect: - It opens the cursor and closes the cursor on each iteration of the loop.It will reselect the same row of data.
Logic in Actions of the step should be such that it will be changing the status of the rows in the table the do select is
selecting. Commits are not ignored and will be committed in a reselect loop when the restart is
enabled.
Restart able: -
similar to select/Fetch but it WILL COMMIT inside the loop thus allowing the checkpoint to the PS_AERUNCONTROL table.
what is the difference between exit(0),exit(1) when we are using this functions in AE
Exit (1) causes immediate termination of a PeopleCode program. Use this parameter to rollback database changes.
Exit (0) caused immediate termination of a Peoplecode Program but dont make rollback in the
database.
DO When" always executed only once.
"DO When", "DO while, DO until" actions always checks the condition whether it is satisfied or not.
. No importance for the data updates.
In "Do when", if the condition is satisfied, system executes the next action called "DO WHILE".
In "Do when", if the condition is not satisfied, system aborts program.
In "Do while", if the condition is satisfied, system executes the next action called "DO SELECT", "PEOPLE
CODE" and "SQL/Call section" actions.
In "DO UNTIL", if the condition is satisfied, then system executes the next step because "DO UNTIL" is the last action of the step.
In "DO UNTIL", if the condition is not satisfied, then system executes from the "DO WHILE" of the same
step.

The difference between writing SELECT(%select) statement in 'SQL' action and 'DO select' action.
Action level properties are different between these two options.
1. Reuse statement property is common between these two actions.
2. "No rows" action property is available for "SQL" action and "Do select Type" property is available for "DO select" action.
3. There are 3 options a.select/fetch b.reselect c.restartable
a) select/fetch - opens a cursor and updates the cursor with the values, once all
rows in cursor are updated then updates the database. In this process, restart
facility will not be available because data is not updating the database after
every row of data.
b) reselect - With this option, no cursor is used. When ever the record is updated,
immediately updates the database. Restart facility is available for this option.
c) restartable - With this option, every record updations updates the database
immediately and also facility to keep break points which are useful for commit at
break points.


ReUse Statement
Enable to optimize the SQL components of your batch program. ReUse converts any %BIND references to state record fields into real bind variables (:1, :2, and
so on), enabling the AE runtime process to compile the statement once, dedicate a cursor, and then re-execute it with new data as often as
your program requires. When you are using SQL to process a large volume of rows, one at a time, inside a fetch loop, compiling
each statement you issue can be a considerable performance issue. ReUse is a way to combat potential performance
decreases.

You have the following options to apply ReUse to your SQL actions:
Bulk
Insert
When used in conjunction with statements like INSERT INTO tablename (field1, field2)
VALUES (%BIND (ref1), %BIND (ref2), Bulk Insert offers the most powerful degree of performance
enhancements related to ReUse. This option turns on ReUse, and, in addition, it holds all the data in a buffer and performs an
insert only after a large volume of rows has gathered in the buffer. The number of rows allowed to gather in the buffer depends
on your database platform. Keep in mind that storing data in the buffers is applicable only if youve selected Bulk Insert and the
SQL is an INSERT statement. For statements other than INSERT/VALUES, the Bulk Insert option is ignored.
No Select this option to disable ReUse. With ReUse off, the AE runtime process recompiles the SQL statement
every time the loop executes. By default, ReUse is disabled.
Yes Select this option to enable basic ReUse functionality.



STATE RECORD (CACHE RECORD)
Tell me what you know about state record? (Cache record)
State records are used to assign variables for Application Engine program. State Record used as a worktable. Key
field is Process_instance. It can be a derived work record or SQL table. No people code fires on AE state record.
To restart facility we put the Process_instance field.
How many rows we can have in state record?
We will have one row in state record. But in case if multiple A.E programs use same state record as default
state record then there will be multiple rows in state record. i.e. one row for each record.

What is Prerequisite for the State record?
1) Should be either Derived work record Or SQL Table.
2) Name of the record must end in AET; this is how the system identifies the record as a state record.
3) PROCESS_INSTANCE must be a key.
4) Any data types except character or numeric must not be required fields.

What field is used as the key field on a state record?
PROCESS_INSTANCE. Used For Restart facility in AE Program.
What Meta SQL is used to retrieve values form a state record? %BIND.
What Meta SQL is used to store values into a state record? %SELECT.

%select : if any values have not selected then previous value will be there
%selectinit : if any values have not selected then previous value will reinitilate to null
Define the following Meta sqls
%Bind: Used for retrieve data from the state record %Select: Inserting values in to state record.4
state Record

%Table: For referencing a table across multiple databases %Truncate: To delete the temporary
table..(Temp Tbl)

Can we specify the Date type field as a Required field? NO
No, we can specify only character and numeric fields as required fields.
State Record: Assign variables for your Application Engine program through state records, while sections, steps, and
actions pass values to subsequent program steps through state records.
--- For assign variables for our Application Engine program through state records.
--- We can specify both work (derived) and physical (SQL table) records to be used as state records.
--- The only difference is that derived state records cannot have their values saved to the database at
commit time, and so the values would be lost during a restart.
--- A PS AE state record must have a Process Instance defined as the first field and the only key field
--- There is only one row in the state record for each process instance, or program.
--- %SELECT - stores data into the State Record. --- %BIND - gets data out of the State Record.
___________
What is restart facility? The restart facility is used to restart the A.E program where it was stopped.

What you need to do for making restart facility in A.E program?
At least one state record needs to be physical record as the data will be available in case of abend.
We have to select the restart check box in A.E program properties dialog box.
In configuration manager Profile select the process scheduler tab and uncheck the disable restart.
To disable, include the option DR Y to the command line of PSAE.EXE (or delete to enable restart)
..If in any of these three places you've disabled restart, then restart is disabled.

(If you are DEVELOPING programs and are ready to TEST but don't want a RESTART condition to get in the way, you could leave the
Disable Restart check box clear in the Program Properties. Then, you could have the Disable Restart check box on the Configuration Manager
selected, or if you are invoking your program from the command line, you could have the Restart flag enabled.
This allows you to TEST new development and avoid errors about forcing you to restart during your TESTING. At the same time it prevents you
from inadvertently leaving Disable Restart selected in the Program Properties when you moved the program into PRODUCTION.)

To enable or disable RESTART in PS Configuration Manager:
1. Start Configuration Manager. Select the Profile tab and click the Edit button.
2. Select the Process Scheduler tab and select or clear the Disable Restart check box appropriately.

What we have to do for RESTART facility?
Program level:
One state record should be sql table.
On the Advanced tab in the AE program properties dialog box make sure that disable restart is not checked
In configuration manager make sure that disable restart is not selected on the process schedular tab
Section level:
The options for section type should be prepare only and critical updates.
If the section is only preparing data as selecting it populating temporary tables or updating temporary tables the section type
should be prepare only.
If the section is updating permanent application tables in the database we should select critical updates.
Step Level:
We need to have some conditions that reduce the answer set returned by the doselect Add and order by clause:
%select field1
select field1 from PS_SOME_RECORD
where field1>%bind(field1)
order by field1
Add a switch to the selected table
Select column1, column2 From PS_TABLE1 Where processing_switch = N
Delete processed rows.

What code we used for RESTART facility?
%select field1
select field1 from PS_SOME_RECORD
where field1>%bind(field1)
order by field1
Add a switch to the selected table
Select column1, column2 From PS_TABLE1 Where processing_switch = N
Delete processed rows.
TEMPARARY TABLES (Work records) IN A.E PROGAMS
Temporary Table:
Temporary Tables are used to store intermediate data. Temporary tables are used for Set
Processing and Parallel Processing. Temporary Tables improve the performance of the program.
Temporary Tables are used to insert or delete the data without interrupting the main record.
Temporary tables are used for parallel processing, set processing to increase performance of the
program.
Temp table instance count for batch programs will be set in AE program properties (Under "Instant
Count" edit box).The max number of instance count for batch programs is 99.
Temp table instance count for online programs will be set in PIA under people tools > Utilities > Administration > People Tools option.

The max number of instance count used by online programs is 3 to 10
Total temp table instances are 99+10+1(Main table) = 110

Instance Count: The Instance Count value controls the number of physical tables to be created for each
dedicated table for this program during the SQL Build procedure in Application Designer. Typically, you
would set this number to equal the number of parallel program runs that you anticipate. For instance if
you expect up to five instances of the same program to run simultaneously, then you would set the
Instance Count to 5.

How can you divide the data to be processed by different instance of the program to perform parallel program?
Run control parameters passed to each instance of the AE program enable it to identify which input rows belong to it, and
each program instance inserts the rows from the source table into its assigned temporary table instance using %Table.
What happens when all the INSTANCE of the temporary table are in use?
It behavior can control by AE developer. If the runtime options are set to continue People Tools will insert rows into the base
table using the PROCESS_INSTANCE as a key. If temp table doesnt contain PROCESS_INSTANCE as a key field in a Temporary
table, you should change the Temp table runtime options to Abort in the appropriate AE programs.
What is temporary table and Instances? (Work record) used to store temporary values.
Temporary table is buffer allocation, which consists of row and columns. AE programs run in batch
mode, multiple instances of the same program often execute in parallel processing. When this happens,
there is a significant risk of data contention and deadlocks on tables. To avoid this PS PeopleTools has a
feature that enables you to dedicate specific instances of temporary tables for each program u run.
U can also use temporary tables to improve performance. Instances determine the no of temp tables to be created.

Diff between _TMP and _TAO?
For on line process we will use _TMP and for batch process we will use _TAO
How you assign the temp tables to A.E program?
Open A.E program > program properties> temp tables Select the table you want Click ok Save the program
Open app designer Open the record Build the record Save

What is restart facility? The restart facility is used to restart the A.E program where it was stopped.
What is A.E run control record? A.E Run control record stores the values of A.E program parameters.
How to read the RUNCTRL PARAMETERS in AE
1) SQL: - %Select (EMPLID) Select EMPLID from PS_AERUNCONTROL
where PROCESS_INSTANCE = %PROCESS_INSTANCE and ORPID = %oprid
2) People code: - &SQL = Select EMPLID from PS_AERUNCONTROL
Where PROCESS_INSTACNE = | PS_TEST_AET.PROCESS_INSTANCE |
and OPRID = | %oprid.

%PROCESS_INSTANCE or %Bind (PROCESS_INSTANCE) can be used.
%PROCESS_INSTANCE is more efficient and faster

What is SET PROCESSING? Set processing is nothing but processing sets of rows at one time
rather than processing each row individually. Set processing enables you to apply your business rule directly on the data
(preferably while it resides in a temporary table) in the database using an update or insert/select statement.
Set processing: - Update database with out selecting the records.
UPDATE PS_XXXXX SET FIELD1 = XXXXXX SET FIELD2 = XXXXXX WHERE DATE > CURRENT DATE.
The following concepts are particularly important:
* Group by and having clauses
* Complex joins
* Sub-queries (correlated and non-correlated)
* Tools for your database to analyze complex SQL statements for performance analysis


Set processing: - This is process is more effective when group of rows need to be updated.
Row by row processing: - This process is effective when single row needs to be updated from a group.

Ex: - Increase the salary for all employees from any dept who's dept profitability is more than 5 Million dollars.
In this scenario, all people under those dept salaries will be increased. This is group of people, thats why applying the set processing.

Ex: - Increase the salary for the manager from any dept whose dept profitability is more than 5 Million
dollars.
In this scenario, only manager under that dept salary will be increased. In this scenario only persons salary
will be increased, thats why apply the row by row processing.



Parallel Processing? The ability for multiple instances of the same program to run simultaneously is called
parallel or concurrent processing.
What are the important steps for implementing the parallel processing?
Define your Temporary Tables. Set the Temporary Tables Online pool.
Assign Temporary Tables to your AE program. Set Temporary Table Batch Pool Instance count in the AE.
Build / Rebuild your Temporary Table record.
Code %Table Meta SQL as reference to Temporary Tables in your AE program, so that AE can
table references to the assigned Temporary Table instance dynamically at runtime.

What is Bulk Insert? Inserting buffering rows into database.
U should consider using this feature only when the INSERT SQL is called multiple times in the absence of intervening COMMITs
Bulk Insert:
By buffering rows to be inserted, some databases can get a considerable performance boost. PS AE offers this
non-standard SQL enhancement on the some databases: Oracle, Microsoft SQL Server, and DB2. This feature is named
Bulk Insert.
The database platform is Oracle, the record contains and EFFDT field (effective date), and the record
contains a Mobile trigger In this conditions are true, Bulk insert is ignored.

DEBUGGING OF A.E PROGRAMS
Why we need the Debugging concept?
After completion of the program successfully, due to some problems the output is not what we
expected, the problem may be the network, hardware, system software, database, procedures or
application software, So that we need to find the mistake. That means we have to debug the program.
How do you Debug an A.E program?
You can set the Debug option in the following locations:
y Start PeopleSoft Configuration Manager and select the Process Scheduler tab. In the Application Engine group,
enable Debug by selecting the Debug check box. This is the method that applies to all methods of invocation.
y If you used the command line option to invoke your AE program, then you can just include the DEBUG Y parameter in the
command line you submit to PSAE.EXE. If you already have the Debug check box selected in PS Configuration Manager, then
you do not need to include the DEBUG parameter in your command line.
y If you have PeopleCode in your AE program, you should also enable the PeopleCode Debugger. When you launch your
program and the PeopleCode Action executes, you will enter the PeopleCode Debugger at that point.

Application Engine supports what type of Debugging Tools?
1. Process Monitor
2. Application Engine Trace file (In the Configuration Manager)
3. Application Engine Interactive Debugger
4. PeopleCode Debugger.






1). Where can we view the failure details of the AE program? Process Monitor.

2). When we use A.E Interactive Debugger? It can be used while running on the client or when running
directly on the server out side of the process scheduler.
How can we access the AE Interactive Debugger?
Set the Debug check box on, in the Process Scheduler folder tab in the Configuration Manager.
Open the Configuration Manager.
First click on the Trace tab and turn off the statement timings.
Click on the profile tab.
Click on the Edit (push button).

On the Process Scheduler page, we will find the Application Engine options.
Select the Debug check box. Click the OK to save the new configuration.

3). How do you enable the PeopleCode Debugger for Application Engine?
Sign on to PeopleTools using the same User ID that you are going to use to invoke the AE program.
Open PeopleSoft Application Designer.
Select Debug, PeopleCode Debugger Mode.

Your AE program can be open on the desktop, but you do not need to open the AE program or the PCode action that you want to debug.
Select Debug, Break at Start.
This causes the AE program to break prior to executing any PCode programs within it.

4). How can we access the Debug Commands, in command line?
After specifying the Debug option in the Configuration Manger, Run any program then we will see the
DOS communication window, then type a ( ?) , And press ENTER. Then it displays all the debugging commands.

How can you debug A.E program form command line argument and other?
PSAE.EXE CT <DB_TYPE> -CD <DB_NAME> -CO <OPRID> -CP <PASSWORD> -R <RUN_CONTROL> -AI <PROGRAM_NAME> -I <PROCESS_INSTANCE>

How can we set A.E Trace file?
For process running on a windows workstation, we can SET TRACE option in configuration manager.
In configuration manager > Trace tab > A.E Trace will be there in that we can set trace.

What do the A.E Trace file shows you?
A.E Trace will show the steps and sql issued in the order and complete information. In
addition it shows execution timings.

What are the 3 trace parameters you can pass to your psae.exe?
- TRACE <trace value>
- TOOLSTRACESQL <trace value>
- TOOLSTRACEPC <trace value>
Which Trace option is the best place to start for general performance information?
TRACE <trace value> 384 mostly used trace value.

What is the difference between a Trace value and Trace parameters?
A Trace value determines which type of trace is turned on.
A Trace parameter determines what type of data is recorded in your trace files (s).

What are the 3 common ways to pass a trace parameter and value to your program psae.exe?
Configuration manager, Process Definition, Command prompt.


Testing And Debugging application engine?
AE Trace file-You can track the step execution of your application execution.
AE Interactive Debugger First click on the trace tab and turn off the statement timings. Select Profile -> Edit Profile->
Process Scheduler Tab -> Application section Select Debug check box.

(You can dynamically modify the state record run AE step by step PCode Debugger for the AE.)
AE Trace files: - AE_<Program Name>_<Process Instance>.AET
Without the process instance: - AE_<Date/Timestamp>_<OS_PID>.AET.
_________

How do you debug an A.E program?
You can set the Debug option in the following locations:
Start PeopleSoft Configuration Manager and select the Process Scheduler tab. In the Application Engine
group, enable Debug by selecting the Debug check box. This is the method that applies to all methods of
invocation.
If you used the command line option to invoke your Application Engine program, then you can just
include the DEBUG Y parameter in the command line you submit to PSAE.EXE. If you already have the
Debug check box selected in PeopleSoft Configuration Manager, then you do not need to include the
DEBUG parameter in your command line.
If you have PeopleCode in your Application Engine program, you should also enable the PeopleCode
Debugger. When you launch your program and the PeopleCode Action executes, you will enter the
PeopleCode Debugger at that point.

Note. Setting the debug capabilities in either PeopleSoft Configuration Manager or the command line
will turn debug mode on. The only situation where this is not true is when you have Debug enabled in
Configuration Manager and you explicitly submit DEBUG N on the command line. In this case, the
PeopleSoft Configuration Manager setting defines your "default" command line value, and the
command line can override the default.
Running AE through Command Prompt:
n:\pt840\bin\client\winx86\psae.exe -CT <dbtype> -CD <dbname> -CO <userID> -CP
<password> -R <servername> -AI <AE programID> -I <ProcessInstance> -TRACE 2
How can you debug A.E program form command line argument and other?
PSAE.EXE CT <DB_TYPE> -CD <DB_NAME> -CO <OPRID> -CP <PASSWORD> -R <RUN_CONTROL> -AI
<PROGRAM_NAME> -I <PROCESS_INSTANCE>

How do you execute Application Engine through Push Button?
1) CreateProcessRequest () , Schedule () 2) CallAppEngine.
What is the syntax for CallAppEngine? CallAppEngine (applid [, state record]);





Meta-SQL Functions
1) %CLEARCURSOR(program, section, step, action)
Use the %CLEARCURSOR function to recompile a re-used statement and reset any STATIC %BINDs.
2) %Execute : Enables you to execute database-specific commands from within your Application
Engine program. Also, the %EXECUTE construct enables you to include multiple statements in a
single Application Engine action without encountering database-specific differences. When you use
the %EXECUTE function, it must be located at the beginning of the statement and can be the only
function or command contained in the statement. The action type must be SQL.

%EXECUTE(/)
DECLARE
counter INTEGER;
BEGIN
FOR counter := 1 TO 10
UPDATE pslock SET version = version + 1; END FOR; END;
/
3) %ExecuteEdits: Enables PS AE to support data dictionary edits in batch. It is AE-only meta-SQL.

%ExecuteEdits(<type>, recordname [alias][, field1, field2, ...])
where <type> consists of any combination of the following (added together):
%Edit_Required%Edit_YesNo%Edit_DateRange%Edit_PromptTable%Edit_TranslateTable

4) %Next and %Previous : used when performing sequence-numbering processing. These constructs
use the current value of the number field as a Bind variable, and then increment (%Next) or
decrement (%Previous) the value after the statement is executed successfully.

5) %RoundCurrency( <EXPRESSION>, [ALIAS.]<CURRENCY_FIELD>)
The %ROUNDCURRENCY function rounds an amount field to the currency precision specified
by the fields Currency Control Field propertyas defined in the PeopleSoft
Application Designer Record Field Properties dialog box.

Note.
If you intend to include multiple SQL statements within a single application engine action you
should use the meta-SQL construct %EXECUTE.
What errors you got when you are running A.E program?

How can we validate AE data?
What is the syntax for reading and writing a file from people code action?
The following example opens an existing Unicode file for reading:
&MYFILE.Open(&SOMENAME, "E", "U");

If &MYFILE.IsOpen Then
while &MYFILE.ReadLine(&SOMESTRING)
/* Process the contents of each &SOMESTRING */
End-While;
&MYFILE.Close(); End-If;
The following example opens a numbered file for writing in ANSI format, without
overwriting any existing files:
&MYFILE.Open("C:\temp\item*.txt", "N",
%FilePath_Absolute);
If &MYFILE.IsOpen Then
&MYFILE.WriteLine("Some text.");
&MYFILE.Close();
End-If;

What are the Component Level Events? PreBuild, PostBulid, SavePreChange, Workflow, SavePostChange
When workflow event fires? After the SavePreChange fires then this Work Flow Event is fired.
What are the save action events? SaveEdit, SavePreChange, Work Flow & SavePostChange
Where is people code stored? Database Server, PSPCMPROG
5) what types of PeopleCode events are there?
Record field, Page, Component, Component Record, ComponentRecordField, Popupmenu.
Sequence of peoplecode events:
Searchinit people code performs before the search dialogue box displays.
Search save performs after the operator clicks ok in the search record dialogue box.
Row select people code is used to filter out rows of data.
Prebuild is often used to hide and unhide the pages.
Field default attempts to set defaults for fields without a value Field formula performs, after field default completes successfully.
Rowinit is used to initialize the rows. Post build pc performs after all the component build events have performed.
Activate event is fired every time the page is activated
People Code Event sequence Execution
1.Search Init 2. Search Save 3. Row Select 4. Prebuild 5. Field Default 6. Field Formula 7. Row Init 8. Postbuild
9. Activate 10. Field Edit 11. Field Change 12. Row Insert 13. Row Delete
14. Save Edit 15. SavePreChange 16. Work Flow 17. SavePostChange
1) When we select a component what events will be fired?
If default mode for component is search mode: ------ only searchinit will fired.
If default mode for component is new mode: ------- field default, field formula, rowinit, searchinit.
How do we refer Component Buffer in the Object-Based or Procedural-Based People Code?
In Procedural Based People code by using scroll path we can refer. In Object-Oriented
People code by Instantiating Objects to Record, Row, Row Set, Field we can refer the Component Buffer.
What is default processing?
In default processing, any blank fields in the component are set to their default value. You can specify the default
value either in the Record Field Properties, or in FieldDefault PeopleCode
What are differed processing and its advantages?
Postpones some user actions to reduce the number of trips to the database so that increases the performance (in system edits, field
edit, and field change). Advantages: 1) Reduces the network traffic. 2) Increases the performance.
Order of Execution of Deferred processing?
This is similar to Interactive Processing where as in this FieldChange, FieldEdit Peoplecode events & System edits
will be differed until we press the Save Button.
What is a RowSet? RowSet is data structer repersenting the hierarchical data,RowSet consists of set of rows ,
Where Each Row consists of set of records and child Rowsets. Used this Rowset object to retrieve the
data from data & component buffer.



























In which events error & warning are used most extensively. Field edit, save edit, Search save, row delete, row insert.
Diff between FieldEdit & SaveEdit? In SaveEdit it checks for all the system edits & Field edits.
What is field change? What are the events fires when a field changes?
When a Tab is pressed or a field value is changed on the page then this occurs. Events that fire are FieldEdit & FieldChange.
What is sqlexec function? This is a function which is used to write SQL commands in People code. This directly
connects to database and execute. Mainly used for Background SQL processing. Retrieves only one row of data.
Can u write the error messages in FieldChange event? No.
What is FieldDefault event? Which is used to assign default values for a field without a value. If 0 defaults
exists for the field then it sets to the system defaults depending on the data type of the field.
What is FieldFormula?
which is mainly used to do calculations and define functions in Derived work record which can be used as function libraries.
Why are FieldEdit and FieldChange Events Used? FieldEdit event is used to validate the contents of a field. It is
performed after the field has changed and new value of the field satisfies the standard system edits. FieldChange event is used
to recalculate the field values and perform additional processing based on the new value of a changed field. It is performed
once field has changed and FieldEdit People code has completed successfully.
Diff between FieldEdit and SaveEdit?
FieldEdit Event used to validate the contents of a field, supplementing the standard system edits. If the data does
not pass the validation, the PeopleCode PROG should display a message using the Error statement, which redisplays
the page, displaying an error message and turning the field red.
SaveEdit Event SaveEdit event fires whenever the end-user attempts to save the component. Use to validate the
consistency of data in component fields. Whenever a validation involves more than one component field, you
should use SaveEdit PeopleCode. If a validation involves only one page field, you should use FieldEdit PeopleCode.
What is difference between field default and Rowinit?
Field default specifies only the default value for a field when we are in Add mode.
Row init fires only when a row of data coming from database to component buffer.
What is the different between RowInit & RowInsert?
The RowInit event fires the first time the Component Processor encounters a row of data. It is used for setting the
initial state of component controls. This occurs during component build processing and row insert processing. It also
occurs after a Select or SelectAll Rowset method, or a ScrollSelect or related function is executed.
When the end-user adds a row of data, the Component Processor generates a RowInsert event. use RowInsert for
processing specific to the insertion of new rows. Do not put PeopleCode in RowInsert that already exists in RowInit,
because a RowInit event always fires after the RowInsert event, which will cause your code to be run twice.
How is the searchinit event most often used by people soft application?
Searchinit fires before the search dialogue page is displayed to the end use. For this reason searchinit is often used to enhance row
level security by inserting and graying out certain values to the search dialogue page.
Difference between Prebuild & Postbuild events and saveprechange and savepostchange?
Prebuild. can be used to validate your search data, discarding rows.
Postbuild.. can be used to play with the pages (hide, unhide), filling up scrolls.
Saveprechange is the last event where you can validate and correct your data before updating the database.
Once it is done, database will get updated.
Savepostchange will be used to play with tables which are not present in your component buffer.
Diff between SavePreChange & SavePostChange?
SavePreChange is fired when the buffer is not cleared where as Save Post change fires When the Buffer is cleared and before
the Commit is issued by the database. (Or)
In SavePreChange we can get the data from Component Buffer for that particular Component where as in SavePostChange
Component Buffer is cleared we have to get data from Database and this is used to update values outside the database.
Does Save Edit & SavePreChange Are in Component Level or Component Record Level? These are available in Component Level.
Ddiff between saveprechange and savepostchange? Which function directly interacts with the database?
Saveprechange---last event that executes before updating the data from component buffer to the database.
Savepostchange fires after the updation of data in the database,before the commit is issued by db.
SQLEXEC --- function directly interacts with the database. we write SqlExec Update in? SavePostChange

Diff between Saveprechange and Savepostchange?
SavePreChange Event It fires after SaveEdit completes without errors. It provides one final opportunity to manipulate data before the system
updates the DB; for instance, you could use IT to set sequential high-level keys. If SavePreChange runs successfully, a WorkFlow event is
generated, and then the Component Processor issues appropriate INSERT, UPDATE, and/or DELETE SQL commands.
SavePostChange Event After the Component Processor updates the DB, it fires the SavePostChange event. You can use SavePostChange
PeopleCode to update tables not in your component using the SQLExec built-in function.
In Save Prechange we can get the data from Component Buffer for that particular Component where as in Save
Post change Component Buffer is cleared we have to get data from Database and this is used to update values
outside the database.
3. What is the diff between SavePreChange & SavePostChange?
SavePreChange is fired when the buffer is not cleared where as Save Post change fires when the Buffer is cleared and before
the Commit is issued by the database. (or)
In SavePreChange we can get the data from Component Buffer for that particular Component where as in SavePostChange
Component Buffer is cleared we have to get data from Database and this is used to update values outside the database.
What are the events at PAGE level how you can use in your application?
Only ACTIVE event. The Activate event is fired each time the page is activated. This means when the page is first
displayed by the end-user, or if an end-user presses TAB between different pages in a component.
Each page has its own Activate event. The main purpose of the Activate event is to segregate (separate) the PeopleCode that
is related to a specific page from the rest of the applications PeopleCode. PeopleCode related to page display or page processing,
such as enabling a field or hiding a scroll, is best put in this event. Also, use for security validation: if an user doesnt have
clearance to view a page in a component, you would put the code for hiding it in this event
Transfer and Transfer Page functions
Transfer closes the current page and transfers the end-user to another page, either within the current component or
in another component. Transfer can either start a new instance of the application and transfer to the new page there,
or close the old page and transfer to the new one in the same instance of PeopleTools.
Transfer is more powerful than the simpler transferpage, which permits a transfer only within the current
component in the current instance of PeopleTools. However, any variables declared as component do not remain
defined after using the transfer function, whether youre transferring within the same component or not.
Transfer (new_instance, menuname.menuname, barname.barname, itemname.menu_itemname, page.component_item_name, action
[, keylist] [, autosearch]);
Transferpage ([page.page_name]) only transfer to a page with in the same component.
What is diff between Sql Exec and Create Sql? SQLExec can only SELECT a single row of data. If your SQL
statement (or your SQL.sqlname statement) retrieves more than one row of data, SQLExec sends only the first row
to its output variables. Any subsequent rows are discarded. This means if you want to fetch only a single row ,
SQLExec can perform better than the other SQL functions, because only a single row is fetched.
If you need to SELECT multiple rows of data, use the CreateSQL or GetSQL functions and the Fetch method
If you want to delete, insert, or update a series of records, all of the same type, use the CreateSQL or GetSQL
functions then ..the Execute SQL object method.
Difference between SQLEXEC and CREATESQL?
SqlExec means it bypasses the component buffer and it is directly contacts database to retrieve data. But it
retrieves the data row by row and not possible for bulk insert. In the case of Create SQL we can able insert the data in bulk.







What are the System variables?
People Tools provides a number of system variables that provide access to system information. System
variables are pref- with the % char, rather than the &character
%AsOfDate: Description: Returns the as-of-date of the environment that the PeopleCode is running in. In most
cases, this is the current date, but for AE environments, it is the processing date of the AE PROG.
%BPName: Description: %BPName is relevant when the user has accessed a page from a Worklist entry. It returns a
string containing the name of the Business Process for the Worklist entry. It returns an empty string if the user didnt access the current page
group from a Worklist.
%ClientDate: %ClientDate returns the current date for the current user, adjusted for the users time zone
%Component: %Component returns an uppercase character string containing the name of the current component,
as set in the component definition.
%Copyright: This system variable returns a string suitable for use as a standard PS copyright notice.
%Currency: This system variable returns the preferred currency for the current user.
%DateTime: %DateTime returns the current server date and time as a Datetime value.
%DbName: %DbName returns the name of the current DB as a String value
%DbServerName %DbServerName returns the name of the current Sybase or Informix DB server as a string
%DbType: %DbType returns a string representing the type of the current DB.

1. What are Different Functions in PeopleCode?
There are totally 4 types of Functions in People code. They are
1. Builtin Functions 2.Internal People code Functions 3. External People code Functions & 4.External Non-People code functions
1. Is there any function in peoplecode which stops the processing of whole component?
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.
Following are Think time functions:
DoCancel - DoModal -DoModalComponent
Exec (only when Synchronous) File attach functions Prompt -RemoteCall -RevalidatePassword
WinExec(only when Synchronous) WinMessage -WinMessageBox.
When should WinMessage be used? The WinMessage built-in function is used to display an
information message to the operator without performing normal error and warning processing. It also
can be very helpful when used for debugging.
What is the purpose of Gray, UnGray, Hide, and UnHide?
These built-in functions change the display characteristics of fields on a panel. The Gray
built-in function will make the field display-only. The Hide will make the field invisible. This
is helpful when enforcing field level security.
What does SetDefault do?
The SetDefault built -in function will clear out the contents of the field. The record default or
FieldDefault PeopleCode can than be applied if appropriate.
Why are All and None used?
The All and None built-in functions check for the presence or absence of a value that the
operator has entered. This can be helpful since a different value may be stored on the
database if a value is not entered into a field based on its type.
When is UpdateValue necessary?
The UpdateValue built - in function must be used when updating the value of a field within a
PeopleCode looping statement.


Why are command push buttons used? What are the advantages?
Command push buttons can be used to trigger PeopleCode programs. The advantage of
using one is that the operator determines when the program should be performed.
What PeopleCode events will a command push button perform? Any FieldEdit and
Fieldchange PeopleCode programs on the field where the push button is attached.

What are the two different ways to retrieve a bitmap to display on the command push button?
Bitmaps can be retrieved from a file using the Browse push button or from the clipboard
using the Paste push button.
How do you attach a field to a command push button?
A field is attached to a command push button in the panel definition. Select Edit, panel Field
properties and modify the field entries under the Record tab.
What are the parameters of a ScrollSelect function?
First the occurs level number and primary record definition of the scroll bar the data will be
selected into. These are followed by the select record, and the When Clause within quotes.
Bind variables are then passed if necessary.
When is the ScrollFlush function used?
Is used to remove the rows of data from within a scroll bar without deleting them from the
database.
What are the parameters of a ScrollFlush function? Name of the primary record definition
for the scroll bar where the rows of data will be removed.



What the data buffer classes?
The classes which consists of methods which are used to access or work on Data buffer.
2. What are Data Buffer Classes in Peoplesoft?
There are totally 4 Data Buffer Classes in Peoplesoft. They are 1. Row Class 3.Field Class 2. Rowset Class 4.Record Class.
3. What is component buffer?.It is a temporary memory area for the people code to access the data base
columns and user defined variables in the people code. (Or)
Tempory memory area to Store data related to Current Active Component
4. How do we refer Component Buffer in the Object-Based or Procedural-Based PeopleCode?
In Procedural Based Peoplecode by using scroll path we can refer. In Object-Oriented Peoplecode by Instantiating Objects to
Record, Row, Row Set, Field we can refer the Component Buffer.
5. Are you used Scroll Area, How many levels we have? For parent/child relationship.4Levels
2. What are the Object Classes available in the PeopleCode?
1.Field Class 2.Row Class 3.Record Class 4. Rowset Class 5.File Class 6.Array Class
7. SQL Class 8.Page Class 9.AE Class 10. Application Class
11. Component Interface Class 12. Bussiness Interlink Class 13. Grid Class 14.Query Class 15. Java Class

2. What are the built-functions used to control translate values dynamically? Adddropdownitem () Deletedropdownitem ()
3. How to change the prompt table Dynamically? Using People Code function %Edit Table.
4. Is there any way by which you can find out whether the user is in Add mode or Update mode?
%mode---returns A-for Add mode. Returns U for Update mode






Component Buffer and Data Buffer
COMPONENT BUFFER: The component buffer contains data of the currently active component.
Data in the component buffers can be accessed using the built in functions and the object classes using the
people code object syntax. (Dot notation).
If the level 0 rowset is formed from a component buffer data, the level zero contains only one row of data. That
row contains all the child rowsets, which in turn contain rows of data that contain other child rowsets.
DATA BUFFER:
A data buffer contains the data of the currently active PeopleSoft application. It can be from a component, an AE or app. message etc.
If the level 0 rowset is formed from the data buffer, the level 0 rowset may contain more than one row of data. Each row of
the level 0 rowset contains all the child rowsets associated with that row, which in turn contain rows of data, that contain other
child rowsets
Accessing data in a component buffer
The data buffer classes are used to access data in the component buffer i.e. the data loaded when component is activated. In addition the
classes can also be used to access the data in buffer loaded due to activation of application message, application engine etc.
Usage of these classes provides improved functionality, flexibility and consistency.
-------------------------------Fields, records, rows and rowsets:-------------------------------------------------------
The foundation classes to access data in component buffer (apart from the built in functions) are:
Field object which is instantiated from the Field class, is a single instance of data within a record and is
based on a field definition.
Record object which is instantiated from the record class is a collection of fields.
Row object instantiated from row class is a single row of data containing one to n records of data. A single row in a component
scroll is a row. A row may have one to n child rowsets. For example, a row in a level 2 scroll may have n level 3 child rowsets.
rowset object is a data structure used to describe hierarchical data. It is made up of a collection of rows.
A component scroll is a rowset.
The classes and their methods can be accessed using the dot notation.
Relationship between the classes
The 4 data buffer classes relate to each other in a hierarchical manner. The main points to understand these relationships are:
*A record contains one or more fields. Records contain the fields that make up that record.
*A row contains one or more records and zero or more child rowsets.
*A row contains the records that make up that row. It may also contain child rowsets.
*A rowset contains one or more rows.
*A rowset is a data structure that describes hierarchical data. For component buffers, think of a rowset as a scroll on a page
that contains all of that scrolls data. A level 0 rowset contains all the data for the entire component.
*You can use rowsets with application messages, file layouts, Business Interlinks, and other definitions besides components.
*A level 0 rowset from a component buffer only contains one row, that is, the keys that the user specifies to initiate that
component. A level 0 rowset from data that isn't a component, such as a message or a file layout, might contain more than one
level 0 row.

Creating objects to access data: Each data buffer access class has its own data type which is the same name as the
class, which you should use when declaring your variables (Rowset objects should be declared as type Rowset, field objects as
type Field, and so on.) Data buffer access class objects can be of type Local, Global, or Component.



Rowset class:
A Rowset object instantiated from a rowset class is a collection of rows associated with the buffer data
Creating a Rowset object: Syntax <Scope> <object data type> <object name> Local rowset &rs;
Note: here the object data type is same as the class name.
Instantiating an object This can be done using the following methods
Getrowset( ) : This method creates a rowset object in the current context i.e. it is populated with data
according to the context in which it was instantiated.
Createrowset( ) : This method creates a stand alone rowset i.e. the records and field references created by this function
are initialized to null values. The rowset can be later populated using the fill, CopyTo or FillAppend methods.
Methods
Activerowcount and Totalrowcount These methods are used to loop through the rows of a rowset.
Activerowcount returns the number of active non deleted rows in the rowset.
Totalrowcount returns the total number of rows including the deleted rows in the rowset.
Getlevel0 This function creates an object that corresponds to level 0 of the component buffer.it takes
no parameters but has a default method GetRow.
Local Rowset &rs; &rs=Getlevel0( ).GetRow(1).GetRowset(Record.Recordname)
This function returns the first row of the level 0 Rowset of the record.
Eg: Local Rowset &rs; &rs=GetRowset (Record.Recordname);
For &I = 1 to &rs.Activerowcount Statement 1.. Statement 2. End-For;

Row class: A row may have one to n child rowsets.
A row object, instantiated from the Row class, is a single row of data that consists of one to n records of
data. A single row in a component scroll is a row.
A row object is always associated with a rowset object, that is, you cannot instantiate a row object without
first either explicitly or implicitly instantiating a Rowset object.
Creating a Row object: Syntax <Scope> <object data type> <object name> Local Row &row;
Instantiating an object &row = Getrow( );
GetRow returns a row object that references the current row in the component buffers. To access
a particular row in a rowset use Getrow (n) --- n stands for the row number you want to access.
Methods
CopyTo (row) This method copies from the row executing the method to the target row. The
parameter row is a row object and not a row number.
Local Row &ROW; Local Rowset &RS1; &RS1 = GetRowset();
For &I = 1 to &RS1.ActiveRowCount
&ROW = GetRowset(Record.Recordname).GetRow(&I);
&ROW.CopyTo(GetRow(&I)); End-For;
GetRecord([Record.Recordname]) With no parameters this method returns a record object for the
current concept. If a parameter is given the record specified should be present in the current row.
Note: &rec is a Record object &rec=GetRecord( ); or
&rec=Getrow( ).Getrecord(Record.Recordname); Or &rec=Getrow( ).Recordname;

Record class A record object, instantiated from the Record class, is a single instance of a
data within a row and is based on a record definition. A record object consists of one to n fields.
Creating a Record Object Syntax <scope> <object data type><object name> Local Record &rec;

Instantiating an Object This can be done using the following methods
GetRecord( ) If a record object is instantiated using this method, it references the record from
the current row in the data buffers and its associated data.
CreateRecord( ) If this method is used for instantiation, the record object is a freestanding
object and all its values are initialized to null values.
Methods
SQLExec The SQLExec function executes a SQL command from within a PeopleCode program by passing a SQL
command string. If you want to delete, insert, or update a single record, use the corresponding PeopleCode record object method.
Update( ), Insert( ), Delete( ) These methods are used to update, insert and delete values from the database.

SelectByKey( ) The SelectByKey method uses the key field names of the record and their values to build
and execute a Select SQL statement. The field values are then fetched from the database SQL table into the record
object executing the method, and the Select statement is closed.
Example: Local Record &rec; &Rec=CreateRecord(Record.Recordname)
&Rec.fieldname.value=recordname.fieldname.value /* fieldname is the key field*/
&rec.selectbykey( ); &Rec.fieldname1.value=recordname.fieldname1.value/*other fields in the record*/
&Rec.Insert( );

Field class A field object, instantiated from the Field class, is a single instance of data within a record
object, and is based on a field definition.
Creating a Field Object Syntax <Scope> <object data type><object name> Local Field &fld;
Instantiating an object GetField( [Recordname.Fieldname] )
GetField creates a reference to a field object for the current context; that is, from the row containing
the currently executing program.
If you don't specify recordname.fieldname the current field executing the PeopleCode is returned.
Methods
SetDefault(Recname.Fieldname) This method assigns default values to a field. If no default value is
specified, the field value is initialized null values.
Blank numbers correspond to zero on the database. Blank characters correspond to a space on the database. Blank dates and long
characters correspond to NULL on the database. SetDefault gives each field data type its proper value.
Hide(Recordname.Fieldname) This property hides the corresponding field on the page.
Data Buffer Access: These are the methods used to access the data buffer. All other methods and properties are of
the component buffer.
CreateRecord CreateRowset FlushBulkInserts GetField GetLevel0 GetRecord GetRow GetRowset


WORKING WITH VARIABLES IN PEOPLE CODE
Variable Declaration:
Local Number &AGE; !-- KEYWORD - LOCAL
=> Valid for the life of the PeopleCode program or function in which it's defined.
Component Rowset &MY_ROWSET; !-- KEYWORD - COMPONENT
=> Valid while any page in the component in which it's defined stays active.
Global String &OPER_NICKNAME; !-- KEYWORD - GLOBAL
=> Valid for the entire session.
Local Any &SOME_FIELD; Local ApiObject &MYTREE; Local Boolean &Compare = True; Local Array of Number &AN, &AN2;
Initializing User-Defined Variables in Declarations:
Local String &MyString = "New"; Local Date &MyDate = %Date; Local Number &N1, &N2 = 5;
Restrictions on Variable Use:
The following data types can only be declared as Local. They cannot be declared as either Global or Component:
*JavaObject
*Interlink !-- Note: Interlink objects can be declared as type Global in an Application Engine program.
*TransformData *XmlNode
The following ApiObject data type objects can be declared as Global:
*Session *PSMessages collection *PSMessage *All Tree classes (trees, tree structures, nodes, levels, and so on.)
*Query classes All other ApiObject data type objects must be declared as Local.
What is an ARRAY in people code? What is maximum dimension of an array? Which function inserts values into an
array? What is pop?
An array is a collection of data storage locations, each of which holds the same type of data.
The maximum depth of a PeopleCode array is 15 dimensions.
Push and unshift are the functions of the array used to add the elements into the array one from the end of the array and one
from the beginning. Pop is a function of array used to select and delete an element from the end of the array.
What are different variables in people code and their Scope?
System variables and User defined variables. Scope --- Global, Component, Local.
What is the diff between the Local and the Component Variables in the PeopleCode?
Local variable scope is up to that particular program where as the CMPT variable scope is up to the particular Component.
What data buffer classes are available in people code? Rowset, Row, Record, Field, Array, File, Sql, chart, grid and so on
How do you perform PeopleCode Debugging?
First we have to set the Debugger mode by selecting Enter Debugger Mode in Debug menu in the AD.
Next we have find which variables we need to Debug, this we can do by selecting local, component or Global variables from the
Debug menu.
Next we have to set the Breakpoints using Toggle Break at Cursor or Break Point at Start from the menu items of
the Debug menu.
What are the ways of Performance Tuning in PeopleCode? Using Object-Oriented programming and Proper programming logic.

Enabling People code Debugger in Peoplesoft 8.4
Below line is added in the Appserv.CFG file of FINDM2
[People Code Debugger]
Enable Debugging = 1
To confirm that People code debugger is working follow the steps below.
1. Log-on to Application Designer in the 3-tier mode.
2. Open any definition that allows People Code and select Debug, Enter Debug Mode from the Application Designer
3. Once the People Code Debugger mode is activated, a Local Variable dialog box appears.
4. Setup the breakpoints by placing your cursor on the desired line of code and choose Debug, Toggle Break at Cursor. This is
useful because you wouldn't necessarily want to debug all of the People Code programs associated with an application at one
time.
5. When you run the application and the debugger hits the break point, your application designer session will begin to blink and
it also halts program execution. You can then step through each line of code by selecting Debug, Step (or pressing F8) to
execute it. You can check the value of the variables you have in the program in the Local Variable dialog box. These values are
updated as the code runs.
6. You must log-on to PIA using the same User ID that you used to log-on to Application Designer in 3-tier mode.

System variables?
%AsOfDate: %BPName:%ClientDate%Component%Copyright: %Currency: %DateTime: %DbName: %DbServerName: %DbType:

5. What are the options for using SQL in people code?
SqlExec Record class methods (selectbykey, delete, insert, update) Using Sql class, its properties and methods.
6. Write the syntax to access third level record field using object oriented peoplecode?
&fld=Getlevel0()(1).GetRowset(Record.<level1 record>.GetRow(1),
GetRowset(Record.<level2record>).GetRow(1),
GetRowset(Record.<level3 record>).GetRow(1),
GetRecord(Record.<level3 record>).GetFieild(Field.<field name>))
7. What is Getlevel 0()? What is the use of %subrec and %selectall functions?
Getlevel0 () ---used the get the rowset of the level0.
%subrec--is used only in Dynamic View SQL where it expands to the columns of a subrecord:
%selectall--%SelectAll is shorthand for selecting all fields in the specified record, wrapping date/time fields with %DateOut,
%TimeOut.
8. Can you save the component programmatically? Using Dosave and Dosavenow functions.
9. Difference between Getrowset and Createrowset in people code?
Getrowset is used to get rowset for a record in the component buffer.
Createrowsetis used to create rowset for a record which in database, and is also called a Standalone rowset.
10. How you can retrieve data from different ScrollAreas, If I want to retrieve Level2 Scroll data which commands you have
used? Scrollselect, fetchvalue, rowselect
11. How to populate data into Grid in online? &Rs.Select() Scrollselect()
12. How you can retrieve data from different ScrollAreas, If I want to retrieve level2 Scroll data which commands you have used?
Get level (0)
FetchValue returns the value of a buffer field in a specific row of a scroll level.
FetchValue(scrollpath, target_row, [recordname.]fieldname) . ,where scrollpath is:
[RECORD.level1_recname, level1_row, [RECORD.level2_recname, level2_row, ]] RECORD.target_recname
where scrollname is the same as the scroll levels primary record name.
13. What is the PeopleCode we write in level one to get data in FIELDS?
ROWSET_LEVEL0 = GetLevel0();
&ROWSET_LEVEL1 = &ROWSET_LEVEL0.GetRow(1).GetRowset(SCROLL.LEVEL1_REC);
&ROWSET_LEVEL2 = &ROWSET_LEVEL1.GetRow(5).GetRowset(SCROLL.LEVEL2_REC); (or)
GetLevel0 : Syntax: GetLevel0()
Description : GetLevel0 creates a rowset object that corresponds to level 0 of the component buffer. If used from PeopleCode that isnt
associated with a page, it returns the base rowset from the current context
14. What is the function to call an app Engine from PeopleCode?
The following calls the AE program named MYAPPID, and passes initialization values.
&REC = CreateRecord(RECORD.INIT_VALUES); &REC.FIELD1.Value = "XYZ";
/* set the initial value for INIT_VALUES.FIELD1 */
CallAppEngine("MYAPPID", &REC);
6. How to refer a low level row from higher level?
By specifying the high level row first and then the low level record.ie; by Scroll path.
Using object oriented Peoplecode and Creating Objects for the rowset.
7. How to refer a second level Field value?
RECORD.level1recordname, &lvl_row, RECORD.level2recordname, &lvl2row, Record.fieldname I the Scroll Path
15. What is message get function? Whats the diff between Message get& Messages get text functions?
This is used to get the messages from the Message Catalog.




Using PeopleCode Events

SearchInit SearchInit event is needed only for records that will be used as search records.
used to set up default values on the search page.
used to set up counters or defaults from the operator preferences on the search panel.
SetSearchEdit(BUSINESS_UNIT);
SetSearchDefault(BUSINESS_UNIT); This example turns on edits and system defaults for the Business Unit field in the search page.
SearchSave Used to validate the search page to make sure all the required fields are filled in.
Can place code here to do the validation of all the fields that must be filled in.
If None(BUSINESS_UNIT) Then
Error MsgGet(9000, 3, Business Unit is a required field.); End-If;

check_status(BUSINESS_UNIT, PO_ID, &STATUS);
If &STATUS = C Or &STATUS = X Then
Error MsgGet(10200, 164, The specified PO exists, and is either Completed or Cancelled.); End-If;

check_auto_num(BUSINESS_UNIT, &AUTO_NUM);
If None(&AUTO_NUM) Then
Error MsgGet(10000, 1, %1 is not a Purchasing business unit., BUSINESS_UNIT); End-If;

If &AUTO_NUM = N And PO_ID = NEXT Then
Error MsgGet(10200, 34, This business unit is not set up for purchase order auto numbering.); End-If;
basically checks that certain fields are filled in. If they are filled in, then the data is validated for specific
conditions. If an error condition exists, an error message is displayed and the search page is not closed.
RowInit
It runs every time a new row of data loads into a page. This section activates code for each level and each data row.
For example, If you have a panel with a level 1 that has 15 data rows that load, the RowInit event will run 16 times:
once for the level 0 (header information) and then 15 times for each row of data on level 1.
You need to understand that even though on the page you can see only five rows of data, this code activates for all rows of data that are loaded
into the buffer. So it is not how many rows are visible on the page, but how many rows are loaded into the data buffer that determines how many
times this PC category activates.
Consider the following 3 examples:
If %PanelGroup = PANELGROUP.VCHR_PO_STD Then
If All(PO_ID) Then VCHR_PANELS_WRK.TXN_CURRENCY_SRC = P; End-If; End-If;

If INSTALLATION.PO = Y Then DERIVED.EDITTABLE13 = ITM_PURCH_FS; End-If;

Gray(LINE_NBR); Gray(SCHED_NBR); Gray(BUSINESS_UNIT_RECV);
The first example shows, based on some information, that you can set some values into special fields.
The second example ,can also set or change the prompts used.
Finally, the third ex: can override the settings on the page to hide, gray (displayonly), unhide, or Ungray (not display-only) fields based on
the initialization.
FieldDefault In this event, field defaults can be coded. Only to set defaults into fields where the logic is too
complex to use the record definition.
If, by contrast, you have a hard default that is always to be used, then you should set that value in the record definition.
Otherwise, you can set the default based on a condition check of some other field or value using code from the FieldDefault event.
For example:
If None(ITM_SETID) Then
ITM_SETID = GetSetId(BUSINESS_UNIT,BUSINESS_UNIT,MASTER_ITEM_TBL, ); End-If;
This example checks whether the ITM_SETID field is filled in. If the field is not filled in, then the code runs a
function to get the information and place it in this field.



FieldChange
Occurs under two circumstances: once when a field is changed, and the other when a button is pressed.
For the field change event, the code does not execute unless there is a net change (changing the value of a field to
its original value is not a net change) and the user moves out of the field or saves the page. Here you can do very
complex validation upon the field.
If VENDOR_ITM_VW1.ITM_STATUS = A Then
If PRICE_DT_TYPE = P And QTY_TYPE = L Then check_line();
Else check_schedules(); End-If;
This example checks the values in a couple of fields and then, based on their settings, runs a different function.
U are not limited to using only the field from which the code is launched, but rather can access any field on the page.
Use when U has a button on a panel;
here you would place the code that you wish to activate when the button is pressed. The code you place for a button
can be just about anything you want. This is what makes button actions so powerfulthey can perform all sorts of
actions, controls, and verifications.:
jump to another panel, fill in the current panel with data based on some criteria you have set, or run a process.
UnhideScroll(RECORD.PO_LINE);
UnGray(GOTO_LINE_DTLS);
SEL_LINE_FLG = Y;
LINES_SAVED = N;
&WHERE = where BUSINESS_UNIT = :1 and PO_ID = :2 and LINE_NBR >= :3;
If All(LINE_NBR_TO) Then
&WHERE = &WHERE | and LINE_NBR <= :4; End-If;
ScrollFlush(RECORD.PO_LINE);
ScrollSelect(1,RECORD.PO_LINE,RECORD.PO_LINE,&WHERE,PO_HDR.BUSINESS_UNIT,PO_HDR.PO_ID,LINE_NBR_FROM,LINE_NBR_TO,T
rue);
This example is from a button which, when pressed, is going to fill in data based on some criteria. The scroll, on level 1 in the panel, is un-hidden (now visible on the
panel), and the data buffer is emptied for this scroll (scroll flush). Finally, the scrolls data buffer is filled with data based on a selection criterion.
FieldEdit To validate information within a field. Event gives you the ability to validate using multiple fields and conditions.
To apply messages from PeopleCode that will not crash the panel, to warn or stop the process within the page.
Place ? Validation that you want to occur within the page field entry process.
If you have validations for which you do not want to leave the field before a specific criteria or process is complete,
then you need to place code in FieldEdit.
To better explain this potential loop problem, assume that you have two fields on a panel. The first field can be set to a value of Red or Blue
only. The second field can be set to a number that represents the brightness of the
color (that is, the first field). Now red can have a brightness only between 1 and 5, whereas blue can have a brightness between 3 and 9. So you
place FieldEdit code in the first field (the color field) that states that if the value is blue, then the value of the second field must be between 1 and
5. This meets the logic requirement, but if you understand the FieldEdit process, you will see how this will get you into trouble. The user enters
Red into the first field and tabs out to the next field. The PeopleSoft Panel Processor then runs the FieldEdit code for the field that states that if
the value is red (which is what the user entered), then the value of the next field must be
between 1 and 5. Because the user has not entered a value in the next field, the value is initialized as 0. Therefore, this FieldEdit code fails and
requires the user to input a value that will not fail. Because youve allowed only red
and blue, and neither is allowed to have a 0 value, then the user can never leave this field. This is a simple explanation, but it shows how you
have to be careful when using FieldEdit code for validation using other fields. You have to understand the capabilities of the system and how the
rules will be applied. In this example, the best solution is to change the location where the validation code is placed. The validation code should
be placed in the Field Edit event of the brightness field, or it could be moved to the SaveEdit event (about which you have not learned yet).
A warning message tells the user that they might not want to continue or to use this value in the field. With a warning message, the user can
decide to stop and fix the issue or move on and ignore the message. A warning means that the value in this field is not normal, but the user is still
allowed to continue. An error message, on the other hand, does not offer the user a choice; the user must stop and fix the problem. You should
make sure that all decisions to error or warn are well documented in the technical documentation for your modification. A message can contain a
lot of useful information; this is discussed in Chapter 14 in the Message and Display Functions section.The following example shows how to
use the FieldEdit to do complex validation with an error message. If a problem occurs, issue an error message to the user stating the problem and
do not allow the process to continue until it is resolved.
check_item();
If None(PO_HDR.VENDOR_ID) Then
Error MsgGet(10200, 76, Vendor %1 is not set up for item %2., PO_HDR.VENDOR_ID, INV_ITEM_ID);
End-if;




FieldFormula
This event is typically reserved for custom-built functions. You have already learned about the flow of how PeopleCode activates
from the PeopleSoft Panel Processor and that the process FieldFormula runs for all sorts of actions. You should not place any
code in this category except custom-built functions.
Consider the following example:
Function update_sched()
&CHANGED_SCHED = N;
UpdateValue(LINE_NBR, &LINE,PO_LINE_SHIP.UNIT_PRC_TOL,&SCHED, &UNIT_PRC_TOL);
UpdateValue(LINE_NBR, &LINE,PO_LINE_SHIP.PCT_UNIT_PRC_TOL,&SCHED, &PCT_UNIT_PRC_TOL);
End-Function;
This example shows a function that performs some actions. A function can take in multiple values and even send
back values to the calling program.
This enables you to write business logic into functions that many programs can call so that you do not have to write
the logic over and over in multiple
PeopleCode categories. This is important to PeopleCode 8.1 in that you now have the ability to place code in new places. By
having more places pages and componentsin which to load PeopleCode, you need to remember that you may require the
same code in multiple places or categories. Instead of copying the code into all these different places and events, you can create
the one function and then call it from the other places, thereby having your logic in only one place. Due to this added complexity,
you will need to think more in terms of functions when writing code.
Writing more functions that you place into this event will save you time and effort in the long run.
RowSelect
This event is used to filter data loaded into a scroll level. This is an advanced technique that will not be covered in
this book. Most developers who want to restrict rows of data create a view to use on the page with the
restriction in the SQL where clause, as you have learned in Chapter 6. By using this event, you can apply this
restriction as you need to or you can even change the criteria as the page is being created.
RowDelete
This event is used to activate code when a delete is performed for a row of data rather than for only a single field. This delete can
be on any level. The developer, when using this code even, can control whether a row of data
can be deleted by checking for orphaned records or other required validations. The purpose of this code is to prevent deletes
unless a specific criterion has been met.
The process to show the pass or fail of the event is just like in the FieldEdit event. If you failed the validation, pass a
message. If you do not issue any messages, then the delete process has passed the validation. This category
can also use the warning and error message commands: An error always fails; a warning reports an issue to the user.

If VOUCHER.POST_STATUS_AP = P Then
Error MsgGet(7030, 109, You cannot delete a voucher line if the voucher has been posted.); End-If;
The code here checks a field for a specific status. If a certain status is set, then the code prevents the deletion by issuing an error
message. If the status is not set, the code will allow the deletion by not issuing any error or warning message.
RowInsert
In the RowInsert event, you apply code to inserts of new data rows. Data,when loaded into the page, is validated through the
RowInit event, but when you add a new record (level 0) or a new row of information (level 1 through 3), there is no RowInit to
activate because it was not initiated into the panel. The RowInsert can and should perform the up-front validations that you would
have placed in RowInit for new data rows being added.
Note - As you can see, you might need to place the same code in the RowInit and RowInsert categories.
This is another reason for looking at code that you could place into functions so that you do not end up copying the same code into multiple categories.

If VCHR_PANELS_WRK.FULL_SET_FLG = Y Then
MERCHANDISE_AMT = VCHR_PANELS_WRK.VCHR_BALANCE_AMT;
VCHR_PANELS_WRK.LN_BALANCE_AMT = MERCHANDISE_AMT; End-If;
This code checks a work record field for a specific status and then updates some fields using information in some other work record fields. The
process done here can be just about anything you think of, from graying (displayonly) and hiding fields to doing complex logic for recalculating a
total.



SaveEdit
In the SaveEdit event, you place code that validates on a save. This is used for the final validation of the record. Usually, you can do a lot of this
validation in the FieldEdit event, but you might want the user to do all the
input they can and then do a check just prior to the save. You might also have to validate multiple fields as a unit. It is hard to do this within
FieldEdit, so you can place the overall validation in this event instead.
A final use for the SaveEdit event occurs when the user does not tab through every field so the FieldEdit code never activates. If you still need this validation, you will
have to add it to SaveEdit to be sure that the code does run.
As with the other edit events, you can prevent or just warn on a save when the validation is incorrect. If you prevent, then the user is unable to save the panel. If you
warn, then the user can stop the save process and edit the problem or they can continue. The process is the same regardless of whether youre using warning or error
messages. Of course, no message means that you have passed the SaveEdit validation.

If DISTRIB_MTHD_FLG = Q And None(QTY_VCHR) Then
Error MsgGet(7030, 49, You must enter either a quantity on Voucher Line %1 when distributing by quantity. Or you can delete the line.,
VOUCHER_LINE_NUM);
Else
If None(MERCHANDISE_AMT) Then Error MsgGet(7030, 49, You must enter either a merchandise amount on Voucher Line %1 when distributing by
amount. Or you
can delete the line., VOUCHER_LINE_NUM);
End-If; End-If

This code checks some values in the fields and then, if certain conditions exist, an error message is issued, preventing the save of this panel.
SavePreChange
In the SavePreChange event, you can place code to change or update the data tables prior to the save being
committed to the database. This is your last chance to make changes. In your page, you are making changes, but
these changes are loaded only into your panel buffers. It is not until you save the record that the database is updated.
Once the save is started, the PeopleCode runs and does all its SaveEdit checks and then just prior to saving the
information to the database, this event occurs. This event enables you to do other processes and update other rows of
data, assuming that the process will complete.
The SavePreChange event, is used mostly to update hidden fields that need to be changed or corrected based on user
input just prior to saving. You do not do updates within SaveEdit, as this is only supposed to be looking for
errors. If you need to total a field in level 1 and place the information in a header record (level 0), here is where you
would make the code work, since you do not want to update the header level field with every row insert or
field change on the level 1. This enables you to put code in one place, and it runs doing the work just prior to the save.
Many developers will place SQLexec function (SQLexec functions will be fully explained in Chapter 14 in the section SQL
Functions calls in this category. SQLexec function calls enable you to run a SQL statement directly
so that you can update a related field that is not within the page. You have to be aware that using SQL direct statements can lead
you into trouble. You must be sure that the record you are going to update or insert is not anywhere within the component. If any
field of the record is on the component,
then you will receive an error: This panel has been updated by another user. This error message is telling you that
something happened to the data between the time you retrieved the data and the time you saved it. Someone
else grabbed the information and changed it prior to your change committing it to the database. The problem occurred because of your
SQLexecit ran and made an update to the database. The PeopleSoft Panel Processor then tries to commit the rest of your changes and sees that
someone else (yes, even though the SQLexec came from your process, the processor sees this as another user) has made a change, so your panel
is not allowed to save. So be extra careful when using SQL calls within the events. This will be explained further in Chapter 14.

For &BUFFER_ROW = 1 To &CURRENT_ROW
UpdateValue(VOUCHER_ID, CurrentRowNumber(),DISTRIB_LINE.DESCR,&BUFFER_ROW, DESCR);
End-For;
This code loops through all the rows of a level 1 panel and updates a value in a lower-level scroll (level 2).
SavePostChange
In the SavePostChange event, you add code that you want to activate after the rows of data have been saved to the
database. Code placed here could be line totals and other calculated fields. This is also where a lot of SQL execs are
written and performed to update other necessary fields.
If %Mode = A and VENDOR.VENDOR_PERSISTENCE = O Then
&SETID = GetSetId(BUSINESS_UNIT, BUSINESS_UNIT,VENDOR, );
SQLExec(Update ps_vendor set VENDOR_STATUS = I
where setid = :1 and vendor_id = :2, &SETID,VENDOR_ID) End-If;
This code example shows that if the page is in Add mode and the vendor is set to a special persistence, then the vendor status must be set back to
inactive so that no further POs can be used. This process is used on vendors
that are set to one time use only. After you use them on a PO, the status is set to inactive so that you do not use them again. You can see in this
example how you are updating the vendor based on an action in the PO system.



PEOPLE CODE PROGRAMS .
1. To make some fields Invisible in a particular page to particular user, if there are more than one user.
If IsUserInRole ("TEST ROLE1") Then
GR_STUDENT_DWR.TOTAL.Visible = False; GR_STUDENT_DWR.AVERAGE.Visible = False;
GR_STUDENT_DWR.GRADE.Visible = False; End-If;
2. To make some fields Display only (read only) in a particular page to particular user, if there are more than one user.
If IsUserInRole ("GDHAR") Then
GR_STUDENT_REC.STUDENT_NAME.DisplayOnly = True;
GR_STUDENT_REC.TELUGU.DisplayOnly = True; GR_STUDENT_REC.ENGLISH.DisplayOnly = True;
GR_STUDENT_REC.HINIDI.DisplayOnly = True; GR_STUDENT_REC.MATHS.DisplayOnly = True;
GR_STUDENT_REC.SCIENCE.DisplayOnly = True; GR_STUDENT_REC.SOCIAL.DisplayOnly = True; End-If;
3. Call AE: &REC = CreateRecord (RECORD.INIT_VALUES); &REC.FIELD1.Value = "XYZ";
/* set the initial value for INIT_VALUES.FIELD1 */
CallAppEngine ("MYAPPID", &REC);

4. Local Rowset &RS Level0; Local Rowset &RS Level1; Local number &Temp;
&RSLevel0 = GetLevel0 ();
&RSLevel1 = &RSLevel0 (1).GetRowset (Scroll.HR_REPORT_TRANS);
&Warning = "N"; &Temp = 0;
For &I = 1 to &RSLevel1.ActiveRowCount;
If &RSLevel1 (&I).HR_REPORT_TRANS.EMPLID.Value =
&RSLevel0 (1).HR_MGR_REP_DAT.SUPERVISOR_ID.Value Then
&Warning = "Y"; End-If; End-For;
If &Warning = "Y" Then
&Temp = MessageBox (1, "", 1120, 860, "Message not found."); End-If;
If None (HR_MGR_REP_DAT.SUPERVISOR_ID) Then
&Temp = MessageBox (1, "", 6605, 411, "Message not found.");
End-If;
Evaluate &Temp
When = 0
When = 1
DoSave ();
Break
When = 2
/* do nothing */
End-Evaluate;
Save post change
If %Mode = "A" and VENDOR.VENDOR_PERSISTENCE = "O" Then
&SETID = GetSetId ("BUSINESS_UNIT", BUSINESS_UNIT, "VENDOR", "");
SQLExec ("Update PS_VENDOR set VENDOR_STATUS = 'I' where SetID =:1 and VENDOR_ID =:2", &SETID, VENDOR_ID); End-If;
FieldChange
: If VENDOR_ITM_VW1.ITM_STATUS = "A" Then If PRICE_DT_TYPE = "P" And QTY_TYPE = "L" Then check_line (); Else
check_schedules (); End-If;
UnhideScroll (RECORD.PO_LINE); UnGray (GOTO_LINE_DTLS); SEL_LINE_FLG = "Y"; LINES_SAVED = "N";
&WHERE = "where BUSINESS_UNIT =:1 and PO_ID =:2 and LINE_NBR >=:3";
If All (LINE_NBR_TO) Then &WHERE = &WHERE | " and LINE_NBR <=:4"; End-If;
ScrollFlush (RECORD.PO_LINE);
ScrollSelect (1, RECORD.PO_LINE, RECORD.PO_LINE, &WHERE, PO_HDR.BUSINESS_UNIT, PO_HDR.PO_ID, LINE_NBR_FROM, LINE_NBR_TO, True);
FieldFormula
Function update_sched () &CHANGED_SCHED = "N";
Update Value (LINE_NBR, &LINE, PO_LINE_SHIP.UNIT_PRC_TOL, &SCHED, UNIT_PRC_TOL);
Update Value (LINE_NBR, &LINE, PO_LINE_SHIP.PCT_UNIT_PRC_TOL, &SCHED, &PCT_UNIT_PRC_TOL);
End-Function;
In level 1 to GET data in fields?
Sol: ROWSET_LEVEL0 = GetLevel0 ();
&ROWSET_LEVEL1 = &ROWSET_LEVEL0.GetRow (1).GetRowset (SCROLL.LEVEL1_REC);
&ROWSET_LEVEL2 = &ROWSET_LEVEL1.GetRow (5).GetRowset (SCROLL.LEVEL2_REC);
(Or)GetLevel0: Syntax: GetLevel0 ()
Description: GetLevel0 creates a Rowset object that corresponds to level 0 of the component buffer.
If used from PCode that isnt associated with a page, it returns the base Rowset from the current context.
5. How you can retrieve data from different ScrollAreas, if I want to retrieve level2 Scroll data which
commands you have used? Scrollselect, fetchvalue, rowselect
8. How to refer a second level Field value?
RECORD.level1recordname, &lvl_row, RECORD.level2recordname, &lvl2row, Record.fieldname I the Scroll Path
9. How to refer a low level row from higher level? By specifying the high level row first and then the low level
record.ie; by Scroll path. Using object oriented Peoplecode and Creating Objects for the Rowset.
Adding required field cue to field C_WOTC
If %Component = Component.JOB_DATA Then
&REG_REGION = FetchValue(JOB.REG_REGION, &MostCurrent); &FLSA_STATUS = FetchValue(JOB.FLSA_STATUS, &MostCurrent);
If &REG_REGION = "USA" And &FLSA_STATUS = "N" Then PER_ORG_ASGN.C_WOTC.ShowRequiredFieldCue = True; End-If; End-If;
Make thstBirthDate field is Readonly DERIVED_STP.YEAR.DisplayOnly = True
Set the grid column label. This needs to be done because when you set the values for the hyperlink,
the grid column heading also gets changed
&GRID = GetGrid(Panel.HR_EMERGENCY_CNTCT, "EMERGENCY_CNTCT");
&GRIDCOLUMN = &GRID.GetColumn("CONTACT");
&GRIDCOLUMN.Label = MsgGetText(18032, 13, "Message Not Found");
&GRIDCOLUMN2 = &GRID.GetColumn("RELATIONSHIP");
&GRIDCOLUMN2.Label = MsgGetText(18032, 14, "Message Not Found");
&GRIDCOLUMN = &GRID.GetColumn("EDIT");
&GRIDCOLUMN.Label = " "; &GRIDCOLUMN = &GRID.GetColumn("DELETE"); &GRIDCOLUMN.Label = " ";
Populate action reason dropdown
&SalRange(&I).DERIVED_HR.ACTION_REASON_SS.ClearDropDownList();
&Xlat = CreateRowset(Record.STP_CONFIG_DTL);
&Xlat.Fill("WHERE CONFIG_ID = 'STPMSS_PAY_ACTREASON' AND CONFIG_VALUE = 'USA'");
For &J = 1 To &Xlat.ActiveRowCount;
&CodeIn = &Xlat.GetRow(&J).GetRecord(1).OPTION_VALUE_1.Value;
SQLExec ("SELECT A.DESCR FROM PS_ACTN_REASON_TBL A WHERE A.ACTION = 'PAY' AND A.ACTION_REASON = :1 AND A.EFFDT = (SELECT MAX(EFFDT)
FROM PS_ACTN_REASON_TBL WHERE ACTION = A.ACTION AND ACTION_REASON = A.ACTION_REASON)", &CodeIn, &DescIn);
&SalRange(&I).DERIVED_HR.ACTION_REASON_SS.AddDropDownItem(&CodeIn, &DescIn); End-For;
This line code tranfers the manager to the search page
Transfer ( False, MenuName.ROLE_MANAGER, BarName.USE, ItemName.OPRROWS_SEARCH, Page.OPRROWS_SEARCH, "U");
Hide Grid (All Rows)
Local Rowset &GridRs; &GridRs = GetLevel0()(1).GetRowset(Scroll.BENEF_ASOF); &GridRs.HideAllRows();

Populate The Secondary page using peoplecode (fieldchange)
If %Menu <> "STP_HR_SELFSERV_ISSC" Then
SQLExec ("SELECT HINT_QUESTION, HINT_RESPONSE FROM PSUSERATTR WHERE OPRID = :1", DERIVED_HINT.OPRID, &HINT, &RESPONSE);
DERIVED_HINT.HINT_QUESTION = &HINT; DERIVED_HINT.DESCR = &RESPONSE; DoModal (Panel.EMAIL_PSWD2, "", - 1, - 1); End-If;

Populate data into scroll area with condition
Evaluate %Component
When = Component.HR_EE_PERS_INFO
ScrollFlush(Scroll.PERSONAL_PHONE);
ScrollSelect (1, Scroll.PERSONAL_PHONE, Record.PERSONAL_PHONE, "WHERE EMPLID = :1 AND PHONE_TYPE <> 'MAIN'",
PERSON_PHONE.EMPLID); ScrollFlush (Scroll.EMAIL_ADDRESSES);
ScrollSelect (1, Scroll.EMAIL_ADDRESSES, Record.EMAIL_ADDRESSES, "WHERE EMPLID = :1 AND E_ADDR_TYPE <> 'LAN'",
PERSON_NPC_VW.EMPLID);
End-Evaluate;

How to hide & unhide the grid from the page by using people code?

In the given example, user wants to hide and unhide the grid from the page by selecting the check box option on the
page. If the check box is checked the grid should be visible else hide the grid & delete the values present in the
grid.The check box is at level 0 & the grid is at level 1.

Function HideAllRows() can be used to hide the grid, & function ShowAllRows() can be used to unhide the grid.

HideAllRows hides all rows of the rowset.
For the given example, write the below people code at field change of check box.
1) Hide the grid.
&Rowset0 = GetLevel0(); &Row0 = &Rowset0(1); &Rowset1 =
&Row0.GetRowset(Scroll.); &Rowset1.HideAllRows();
2) Delete the data from the grid
&Rowset0 = GetLevel0(); &Row0 = &Rowset0(1); &Rowset1 = &Row0.GetRowset(Scroll.);
For &i = &Rowset1.ActiveRowCount To 1 Step - 1
&Rowset1.DeleteRow(&i); End-For; OR

If the data is present in the component buffer & not present in the data base, then use function flush() to delete the
data from the buffer.
&Rowset0 = GetLevel0(); &Row0 = &Rowset0(1); &Rowset1 = &Row0.GetRowset(Scroll.); &Rowset1.flush();
3) Unhide the grid
&Rowset0 = GetLevel0(); &Row0 = &Rowset0(1); &Rowset1 = &Row0.GetRowset(Scroll.);
&Rowset1.ShowAllRows();
Manipulating Data on a Grid: Scroll Peoplecode
When you have a grid that is filled with data; data that you dont want. How do you clear it out and then fill it with the data
set that you do want?
Well, here are the simple steps to do just that. Lets say we have a Grid on a page and the main record on the grid is called
COMPETENCIES. Well we would first want to define a Rowset object to manipulate. The code for this would look as follows:
Local Rowset &COMPETENCIES;
Next we will want to instantiate the object. Instantiate just means to represent by an instance. If you notice, I am not creating a new Rowset. I
am getting the Rowset from the current grid called competencies, using the GetRowSet function. And, I am defining the Grid object as a
Rowset.
&COMPETENCIES = &REVIEW(CurrentRowNumber(1)).GetRowset(Scroll.COMPETENCIES);
Once that is complete, I want to remove all rows of data from the Grid. To do that I simply use the Flush method.
&COMPETENCIES.Flush();

Now lets fill the grid with new data that we really want.
&COMPETENCIES.Select(Record.COMPETENCIES,WHERE EMPLID = :1 AND EVALUATION_ID = :2 AND COMPETENCY IN &IN
AND EFFDT = %DATEIN(:3), &EMPLID, &EVALUATION_ID, &REVIEW_DT);
What I am doing in the above line of code is selecting the data that I want to use to fill the grid. By selecting the record I am in
essence asking to select all the fields that are on the grid from the COMPETENCIES table with the where clause.

Inserting rows into record using Peoplecode with better performance
When inserting rows using People code, you can either use the Insert method with a record object, or
create a SQL Insert statement using the SQL object.
If you're doing a single insert, use the Record Insert method
If you're in a loop, and therefore calling the insert more than once, use the SQL object.
Why? Because the SQL object uses dedicated cursors and if the database you're working with supports it, bulk insert.
A dedicated cursor means that the SQL only gets compiled once on the database, so People Tools only looks for the meta-SQL once. This can
mean better performance.
For bulk insert, inserted rows are buffered and only sent to the database server when the buffer is full or a COMMIT occurs. This cuts down on
the number of round trips to the database. Again, this can mean better performance.
The following is an example of using the record insert method:
&REC = CreateRecord (Record.GREG); &REC.DESCR.Value = "Y" &I; &REC.EMPLID.Value = &I; &REC.Insert();
The following is an example using a SQL object for doing an insert:
&SQL = CreateSQL ("%INSERT(:1)"); &REC = CreateRecord(Record.GREG); &SQL.BulkMode = True;
For &I = 1 to 10
&REC.DESCR.Value = "Y" &I; &REC.EMPLID.Value = &I; &SQL.Execute (&REC);
File layouts for inserting data into parent-child records. (File layouts for inserting data in to multiple records).
Define the file layout with the child record as sub-segment. In File layout segment properties define the
file record id. A number that should appear as a first column in the input file to identify that it contains
the data for its corresponding record.
Since we have more than one record, we need to set this file record id for the both records / segments.
888 File record id - This record contains only one field and its value is A.
000 File record id Contains the data for the other record.
Sample file layout structure.
888 A
000 8001 VAC 1981-09-12 1981-09-26 14 .0 P Y
888 A
000 8001 VAC 1983-03-02 1983-03-07 5 .0 P Y
888 A
000 8001 VAC 1983-08-26 1983-09-10 13 .0 P Y
888 A
000 8516 MAT 1986-06-06 1986-08-01 56 .0 P Y















What is SQR used for? It is a Reporting Tool for creating customised reports to be run from PeopleSoft
panels for formatting reports, data transfer, data uploading/downloading etc.
Where and when do we use SQR? 1. Where the Programming logic is more.
2. If We need to generate different kinds of reports. 3. Background SQL processing. 4. File Interfacing. Etc

Processing sequence of SQR
Compile Stage All #Include external source file (SQCs) are inserted into the source.
All #commands are evaluated. The #DEFINE text substitution variables are placed into the program source.
The SETUP section is processed, including allocation and population of memory arrays created by the Load-Lookup and Array commands.
Work buffers are allocated. Optimization of the SQL data access path is determined. Syntax of SQR source program is checked.
Execution Stage Processes data for the Body section Processes HEADING section Processes FOOTING section
Writes entire page buffer to file.
How you can see the SQR Errors (after Execution)?
SQR normally places the SQR PROG output files in the directory from which you run the PROG. The output file has the same
file name as the SQR file that created it, but the file extension is different.
To produce the desired output file for this exercise, the -KEEP flag is used in our example. We
explain the -KEEP flag later in this guide.
The output files should appear as soon as your PROG has finished running. If you specified the -KEEP argument, one output file
is in SQR Portable Format (recognizable by its .SPF extension). SQR Portable Format is discussed later in this guide but for now,
you can easily view the sample PROGs .SPF file output, ex1a.spf, on Windows platforms with the SQR Viewer GUI (sometimes
referred to as an SPF viewer"). The SQR Viewer is invoked from the command line with sqrwv.
Default output file is .lis If u specify -keep the output file will be in .lis or .spf(sqr portable format)

What are the sections and paragraphs available?
There are five sections and three paragraphs available in SQR programming. The sections include
Begin-setup End-setup. Begin-program/Report End-program. Begin-procedure End-procedure.
Begin-heading End-heading. Begin-footing End-footing
And the paragraphs include: Begin-select paragraph. Begin-SQL paragraph. Begin-document paragraph

What is the only required section of a SQR Program?
The only required section of SQR program is BEGIN-PROGRAM with its corresponding END-PROGRAM.
What is a difference between Begin-Select & Begin-SQL? BEGIN-SELECT has only one SQL statement.
BEGIN-SQL can have any number of DML statements & it can also have PL- SQL statements for oracle & each statement should end with
double semi colon (;;).

File types in SQR? 1. .SQR=This is nothing but the SQR source file. 2. .SQC=This is a used as functional Libraries.
3. .Lis=This is Line Printer Output file. 4. .SPF=This is a Portable format file.
5. .SQT=This is Complied time file. 6. .INI=These files are used to set the default Environment for our SQR Report.
7. .MAX=These are used to increase the memory size. 8. .ERR,.LOG,.DAT=These are used for Error Handling purpose.

What is the SPF File? What are the Flags required to make a file to SPF?
SPF is a Portable Format File and the command line flag used is KEEP.
What is the SQT file? What are the advantages of SQT files?
SQT file is nothing but resultant file after the compilation (i.e.) Runtime File. By using this SQT file for Execution we can increase
the Performance of the program by reduciong the Compilation Time.
Can a .sqt file be "de-compiled" into the original SQR code? No. This is not possible.
What are the uses of SQR portable files(spf)?
We can create the printer independent output files, so that we can view, e-mail, fax and print these files by using
the SQR Viewer. And we can also convert back to the .LIS files by using the SQR printer.
What is the difference between .LIS and .SPF files?
Lis files are printer specific output report files. .spf we can create printer independent output files. .lis files are not convinient for
viewing the file before printing or to email. .spf files can be viewed and printed by the SQR viewer and also can be emailed.

List Out some Command Line Flags in SQR? -S,-A,-KEEP,-ZIV,-XMB,-ZMF,-E,-O,-Debug,-RS,-RT etc
What is Bnn,--Tnn,--RS & --Rt Flags?
--Bnn for specifying default number rows to retrieve from the database.
--Tnn used for Testing Which specifies the number of pages we want to test.
--RS is used to create a .SQT file. --RT is used to run .SQT file.
What is -Bnn flag? This is used to specify the number of rows that are to be taken from Dbase to the Buffer
because default the system takes 10 rows at a time.
-Tnn flag? This is mainly used for testing purpose. We can restrict the system to generate only a specific number of
pages instead of generating all pages for testing. This is used in Windows Environment.
-RS & -RT Flags? RS is used to generate SPF file ie; stopping the program after the comilation. _RT is used to run the SPF file
.This is also one kind of Performance increasing technique by saving the compilation time.

How can I suppress display of the SQR banner line when running SQR Use the -XB flag.
What is the value used with -C flag of BEGIN-SELECT?
BEGIN-SELECT -Cflag (Oracle, Ingress, SQL Base) - sets query buffer size.
use the -F command line flag for multiple reports?
Lets look at the following example. The program "ex20a.sqr" creates 3 reports.
sqr ex20a tutorial/secret -Flabel.lis -Fletter.lis -Flisting.lis
Which types of command line flags are useful for creating the .SPF files?
-ZIV, -KEEP, -NOLIST.

What are ziv and keep command line flags?
-keep is the SQR execute command line flag causes SQR to create spf output in addition
to .lis.
-ziv is used for invoking spf viewer after generation SQR output files.
SQR for TESTING purpose?
-Tnn command line flag. For example, -T6, it will stops the program after six pages of
output have been created.
we use the Tnn command line flag?
If we use this flag SQR ignores BEGIN-SELECT ORDER BY clauses.

What is the use of the Tnn command line flag?
We can speed up the testing cycle. And we can stop the execution after getting the
specified number of pages for our report output.

What are the other command line flags supports the SQR for Testing and Debugging purpose?
-S, -C, and E[file]
What is the use of the S command line flag?
It will show the status of the program cursors. After completion of the program it will
display the following information:
Text of each SQL statement
Number of compiled SQL statements and number of executed SQL statements.
Total number of rows selected.
All these information will be stored into the log file.

What is the use of the C command line flag?
It creates the Cancel Dialog Box during the program run, So that we can cancel the
execution of the program when necessary.

What is the use of the E[file] command line flag?
We can save the error messages by specifying a file name. Default file name is the name of the
program with the extension .err. If SQR generates no messages, no err file is created.
What is the value used with -C flag of BEGIN-SELECT?
: BEGIN-SELECT -Cflag (Oracle, Ingres, SQL Base) - sets query buffer size. If the value of the -C flag is up to
256 it is in kilobytes, any number over 256 is in bytes only.For Oracle the default is set by the
context_area parameter in the init.ora file - the default is 4096.
How to use the -F command line flag for multiple reports ?
Lets look at the following example. The program "ex20a.sqr" creates 3 reports.
Example: sqr ex20a tutorial/secret -Flabel.lis -Fletter.lis -Flisting.lis
In the above example, what would be the names of the SPF files if we use a -keep command line flag ?
The names will be: label.spf letter.s01 listing.s02
How to find out Which SQL is running in SQR? Using -S flag while executing SQR at runtime.
How can you Debug SQR programs? We can Debug SQR using Debugging Commands such as
1. #IF DEBUGxxx #END-IF 2. DISPLAY and 3. SHOW
What is Debug Command Line Flag? -DEBUGxx.
what are the debugging commands in sqr? Show & Display are debugging commands
Show is used to display more than one variable at a time. Display is used to display only one variable at a time.
How do we Debug SQR? By using #Debug, or #Ifdef Debugx #endif. Using Show or Display command.
What Commands are used to show Output on Screen of an SQR at runtime ?
Display & Show are the commands for that.

What are the commands SQR supports for Conditional Debugging purpose?
1. #debug 2.#if 3. #Else 4. #ifdef 5.#ifdeg 6.#End-if
What happens? If we specify like the following:
2. Suppose that debugxyz is command line flag and the following are debug statements.
#debugx show x
#debugy show y
#debugz show z
#debugz show a
#debugz show b
The output is
show x
show y
show z
because #debugxyzab flag was not specified.
What is the limit for SQR command line length on PC/Windows?
The limit is 128 characters. This is a PC limitation not an SQR limitation. You may want to have the SQR
BINW directory on your PATH so that the full pathname to the SQRW executable is not needed.
Arguments can be put into a report argument file that is specified with @file on the command line.

How will perform Error-Handling in SQR?
Using the command line flags O,-L,-ZMF and XMB
Using SQR commands ON-ERROR=Skip/Warn/Stop, ON-ERROR=Procedure_name
How will you perform ERROR handling in SQR?
We can do Error handling in SQR using some command line flags such as O, -L,-ZMF,-XMB and using Error
handling commands such as
ON-ERROR = Skip/Warn/Stop (for Compile time errors)
ON-ERROR = Procedure Name (for execution stage errors).
How do you trap Errors in SQR? a) Using BEGIN-SELECT ON-Error=ErrorProcedureName
b) In procedure display #SQL-Error to show ErrorNumber &$SQL-Error to display message.




What are the File Manipulation commands in sqr?
Open,Close,For-Reading,For-Writing,For-Appending,Read & Write.
What are the commands used in File Handling of sqr?
Using File Handling we can Import. Steps are
1. Opening a File Using OPEN FOR-READING commands. 1. Reading Data From File Using READ command.
Writing Data into Table Using BEGIN-SQL paragraph & INSERT command

What are Open & Read functions of File Opening in SQR?
Open Vendor.dat as 1 for-reading record=50:vary
Open C:\sqrtemp\vendor2.txt as #1 for-writingrecord=93:FIXED
If #filestat=0 (file opened successfully)
Write #1 FROM $iSalVCode:3 End-If




How does SQR provide you the ability to verify that a file was opened successfully?
If you assign a numeric variable to the STATUS=in a file OPEN, you may check the numeric variable after the OPEN.
If the OPEN fails, this variable will contain -1.
What is the maximum record length for the OPEN command? The maximum is 32K bytes (32767).
How can I read in variable length delimited fields from a sequential file?
An example format would look like this: field1|field2|field3|...
Ans: Instead of reading a record into individual fields, read the entire record into one field and then use the SQR
unstring command to separate the delimited fields.
Example :
begin-report open 'test.dat' as 1 for-reading record=80:vary
while 1 read 1 into $record:80 if #end-file
break end-if
unstring $record by '|' into $field1 $field2 $field3 ...
show $field1 ' ' $field2 ' ' $field3 ... end-while close 1 end-report
Can I use 'dynamic column names' in Begin-Select (versions prior to v3.0)?
Yes, see following workaround. This SQR report will actually write another SQR code with column names supplied
by the user and execute it. Note that in SQR Version 3.0, dynamic columns are directly supported. Example:
begin-procedure main
move 'DEPTNO' to $col1 ! You might use INPUT here to prompt the user
move 'ENAME' to $col2 ! to enter the column and table names instead.
move 'EMP' to $tab
move 'sqrout.sqr' to $sqrpgmnam let $syscmd = 'sqr '||$sqrpgmnam||' user/password'
move 100 to #flatfileid open $sqrpgmnam as #flatfileid for-writing record=132
write #flatfileid from 'BEGIN-REPORT' write #flatfileid from ' DO MAIN'
write #flatfileid from 'END-REPORT' write #flatfileid from 'BEGIN-PROCEDURE MAIN'
write #flatfileid from 'BEGIN-SELECT' write #flatfileid from $col1 ' (+1,1)'
write #flatfileid from $col2 ' (,30)' write #flatfileid from 'from ' $tab
write #flatfileid from 'END-SELECT' write #flatfileid from 'END-PROCEDURE MAIN'
close #flatfileid call system using $syscmd #status display 'Status of call is ' noline display #status end-procedure






How can I find out if rows are selected by a BEGIN-SELECT paragraph? Can I use the SQR variable #sql-count?
#sql-count indicates the number of rows affected by a DML statement (insert, update, or delete).
It cannot be used for a BEGIN-SELECT paragraph. The solution is here below:
begin-procedure main1
move 0 to #count ! This is optional unless main1 is called more than once
begin-select column1 column2 column3 add 1 to #count from table1 end-select
if #count > 0 show 'Number of rows selected was ' #count edit 999
else show 'No rows selected' end-if end-procedure main1
How do you control the number of iterations or fetch records firing SQL statement in SQR. : By
using Begin-Select Loops=<number> statement.
What PeopleCode must be on all Run Control Records?
: On the PRCSRUNCNTL record, the RowInit on OPRID and the SaveEdit on RUN_CNTL_ID.
What restricts the size of LOAD-LOOKUP memory arrays? : Available memory.
How can I prevent the printing of the empty page at the end of every .LIS file?
Delete the last line in the .LIS file through an editor or this can be automated with CALL SYSTEM USING command
which would execute the following SQR code.This program reads an ASCII file, removes the last line (the line
having the Form Feed) from it and writes the output to another ASCII file.
In BEGIN-SELECT do the FROM and WHERE clause have to be aligned to the left margin
No. Only the selected columns have to be.

What are the steps in performance tuning? Using Loadlookup & Arrays,
Using Command line flags such as bnn & -s, Using proper programming in our SQR program, Using
Proper SQL in our SQR program, Using Multiple Reports, Using SQT files and Running on Batch Server.
How many ways of performance tuning are there in SQR?
1. Using LOADE-LOOKUP & LOOKUP. 2. Using ARRAYS. 3. Using MULTIPE REPORTS.
4. Using SQT Files. 5. Using Bnn Command line Flag. 6. Running on BATCH SERVER.
7. Using Proper Programming Logic in SQR such as Using BREAK statement in EVALUATE Command.
8. Proper SQL tuning such as using Sub queries instead of Joins.
How to pass Inputs for sqr program while running from windows? Using ASK & INPUT Commands.
How to pass Inputs to the SQR while running through the Process Scheduler?
Using Procedures & SQCs to access data on Run Control Page (Run Control Fields).

Use of the MOVE Command? It moves the data from on field to another field and it can also perform data conversions and
data editing using special edit masks. it can handle data of any format except date to numeric vice versa.
What is Let command? A single Let command is capable of replacing a no of data manipulations and logic commands
What is the syntax of the LET Command?
LET target_variable = expression Expression can be combination of operands, operators, and functions.
Operands in the expression can be SQR columns, literals, or array fields.
Operators in the expression can be arithmetic, string or relational.
What is the difference between Move and Let command?
Move command is used for data conversions where as let command used for data conversations as
well as logical expressions and calculations.
What is the difference between Command line flag arguments and command line arguments?
Command line flag arguments are simple parameters related to each specific flag. And command line arguments
are application specific input parameters that are retrieved by the program from the command line using the
input and ask command.
Diff between ASK & INPUT Commands?
ASK: 1. This is used in the Setup section i.e. . Compile Time Variable.
2. This prompts for the values during the compilation time. 3. This does not have the data type and length.
INPUT 1. This can be used in other than the Setup section i.e. Run time Variable
2. This prompts for the values during the Execution Time. 3. Here, we can specify the data type and the length.
What is a difference between Ask & Input command ?
Ask is a compile time substitute variable which is defined in Begin-Setup. It is used to take an input at compile time. For ex: you
want to accept a printer from user at compile time. Input command is used to accept user input at runtime.

How do we work on Effective dated rows on SQR? Write a subquery to get current effective date & then write an
outer query for matching effective dated rows from a record.

Effdt and EffSeq Quries?
Select * from Table1 A where A.EffDt= (Select Max (B.EffDt) from Table1 B where
A.keys B.keys AND A.EffDt<= as of Date)
Select * from Table1 A where
A.EffDt= ( (B.EffDt from Table1 B where A.keys B.keys AND A.EffDt<= as of Date) AND
B.EffSeq=(Select Max(C.EffSeq from Table1 C where B.keys=C.keys AND B.EffDt=C.EffDt AND B.EffSeq=C.EffSeq);

What are the steps required to run the SQR from peoplesoft environment?
- Three steps we have to fallow to run the SQR program from the peoplesoft environment (Process
Scheduler). These steps include
- Making the SQR program API aware by calling two procedures (stdapi-init, stdapi-term) from the
Begin-program section and including the Stdapi.sqc in the bottom of the program.
- Create new run control table or using existing run control table and creating run control page,
component and register the component. Creating new run control SQC if we create a new run control
table.
- Giving the permission to the user by giving process groups.
What is Process Scheduler? This is a People tool used to Schedule and monitor the Execution
of any Process or Report or Program in PS Environment.
How do you link SQR reports to process scheduler?
- Create/modify/add run control table if you have any new fields
- Create/modify/add run control page if you have any program inputs
- Create a menu definition (Note Menu group name: XYZ) - Give operator security
- Create Process scheduler definition -Use-Process definition process definition add
- Give report name and report type.
How do you Execute SQR using Process Scheduler ?
- a) Include some RunControl panel having OperatorID & RunCntlID.
- b) This panel includes PRCSRUNCNTRL table & RUNCNTRL table having OperatorID & RunCntlID.
- c) Add your own input fields to this RunControl record & also drag drop it onto your panel.
- d) Write PeopleCode OPRID = %OperatorID; in RowInit event of OPRID field.
- Write procedure into SQR code which would have an SQL statement to fetch you fields from RUNCNTL
table. Remark all input fields. Execute this procedure in else part of If $prcs_process_instance = which
means that this sqr is to be executed from Process Scheduler.

What is Process Monitor used for? A centralized utility allowing you to monitor the status of process requests
that you have submitted, by displaying a list of currently logged requests waiting to be processed. From this list
you can view the active list of Process Scheduler Servers and stop their execution depending on your level of
security.




How to pass command line flags to a sqr report running through process scheduler?
- Using override options in the process definition in the Process Scheduler in the People Tools.
How does peoplesoft Process monitor knows that the process (Say sqr report) is at what stage such as initiated,
in process, completed etc
- From the Field Value of RUNSTATUSDESCRfield from PS_PMN_PRCSLIST table.
How do you run SQR Report from DOS Prompt using a Batch File?
- C:\FDM75SU\sqrbinw\SQRW.EXE
- c:\sqrtemp\%1.sqr EPDMO/SYSADM/SYSADM I c:\FDM75SU\sqr\ <IncludeFile Path>
- -Mc:\FDM75SU\sqr\AllMaxes.max -Oc:\SQRTEMP\sqr.log(LogFile)
- -Fc:\sqrtemp\%1.lis(Output File)
- -ZIFc:\FDM75SU\sqr\Pssqr.ini -lockrl
- REM -XCB (do not display Communication Box)
How SQR identifies where we keep sqr files (Path of SQR files)? It is specified in Configuration Manager.
Can you call procedure in oracle from Sqr? How?
To call a database procedure using Begin-select paragraph, the syntax is as follows:
Begin-select <Procedure name> [(report arguments)] from Dual End-select
To call from Begin-sql, the syntax will be
Begin-SQL <procedure-name>;; End-SQL
Where should you place user prompts for non-Process Scheduler execution?
: In the Init-Report procedure, in the following code:
If $prcs_process_instance= !prompts go here End-If
What PeopleSoft tool is used to change the value of your SQR environment variables?
: The Configuration Manager.


Running SQR from Command Line
D:\PT848\bin\sqr\DB2\BINW\sqrw.exe D:\pt848\SQR\infup_file_name.sqr -iD:\pt848\SQR\ -xmb -xcb -
ZIFD:\pt848\SQR\pssqr.ini -S -DEBUGX -PRINTER:PD -EH_PDF -fD:\pt848\output_file_name.pdf -
oD:\pt848\log_file_name.log Options:
-i => Input file Directory -f => Output File Name -o => Log file Name -ZIF => SQR Initialization File Name

API aware?
An API aware process updates the process request (PSPRCSRQST) table with the process
run status.
If we want to run any program we should specify
C:\>SQRW <PROGRAM_NAME> <DATABASE_NAME>/<PASSWORD> <OUTPUT_DIRECTORY>
C:\>SQRW SAMPLE.SQR HRMS/PS FC: \TEMP

If we want to pass any run time values we should specify
C:\>SQRW <PROGRAM_NAME> <DATABASE_NAME>/<PASSWORD> <OUTPUT_DIRECTORY> <values>
C:\>SQRW SAMPLE.SQR HRMS/PS FC: \TEMP 100
How do we run the sqr through peoplecode?
This is the code to run the sqr thru PeopleCode.

&RQST = CreateProcessRequest(); &RQST.ProcessType = "SQR Report"; &RQST.ProcessName = "HAPDT009";
&RQST.RunControlID = "1";
&RQST.RunLocation = "PSUNX"; &RQST.OutDestType = "File";
&RQST.OutDestFormat = "PDF"; &RQST.RunDateTime = %Datetime;
&RQST.TimeZone = %ServerTimeZone; &RQST.Schedule();
&PRCSSTATUS = &RQST.Status;















Variables And Arrays

What are different types of variables in sqr? Types of variables in SQR are
1.Column Variables. 2. List Variables. 3. System Variables. 4. Document Variables.5. Substitution Variables. and User Defined Variables
What is #, $, & used for? #Numeric, $String, and &Database field values.
What are variable types in SQR?
& Data base reference fields Read only $ Character (Same for Date)
# Numeric { } Variable in ASK or # define [$ variable] Dynamic variable referencing

Is there any read-only variable in sqr? Column Variables & System Variables are Read-Only Variables.
What types of SQR variables are read only? Database column variables and most internal reserved SQR variables are Read Only.
Are SQR commands and variables case sensitive? No.
Commands can be spelled with any case combination. The SQR variable $string is equivalent to $STRING.
How to refer a global variable in local procedure?
After special character (ex.#,&) we use underscore(_) after that variable name.
How do I Reference Global variable in a local procedure in SQR?
I can access Global variable with #_VariableName from local procedure.
How do you differentiate printing a database column & any other variable in a select statement?
Database fields should start with the 1st column. Indent other print statements with at least one column right.
How do I right justify a text string?
Use the LPAD function of the LET command to add blanks to the start to the string. For example: let $s = lpad($s, 80, ' ')
How to print current date in SQR? : Print $current-date (1,1) EDIT DD/MM/YYYY or use
internal function or DateNow for current date & time.
How to Define Constant & its usage in Begin-Select? #define MAX_LABEL_LINES 10
Can I set the current page number in an SQR program? Yes.
Move the desired value to the SQR variable #page-count.
Do SQR programs require a .sqr extension? Do SQR runtime files require a .sqt extension?
SQR programs do not require a .sqr extension. SQR runtime files require a .sqt extension.
How can I insert a null value into a numeric field in the database ? I tried not giving a #variable a value but that
did not work, 0 was inserted.
When doing the insert, list only the fields for which a value is known. All other fields will get the null value.

How do you Optimise SQR ? a) You can optimise SQR by breaking big sql statements into simple sql statements.
b) Using LoadLookup command. c) Using an Array or flat file instead of database tables.
d) Examining Cursor Status by using -S flag while executing sqr.
What are the differences between Load lookup and Array
ARRAYS LOAD-LOOKUP
1. Arrays can be declared in any section. 1. Load-Lookup is declared in only in SETUP section only.
2. Number of rows are not automatically 2. Numbers of rows are automatically added. gives a error if the
Exceeds the specified number. number of added.
3. We should insert data in to Array by programming. 3. Rows are automatically inserted in to Load-Lookup.
4.We can retrive any number of fields from a table. 4.We can retrive only Two fields from a table.
5.We have Length & Data type. 5.We dont have Length & Data type.
6.We cannot directly print from Array. 6.We can directly print from Load-Lookup.
What is a syntax of LoadLookup ? Ans: It is declared in Begin-Setup.
Syntax: Load-Lookup Name=<name>
Table = <tablename>
Key = <primarykey>
Return_value = <FieldName>
Where = FIELDNAME= <fieldname>



What is Load-lookup? Give the Syntax for Load-Lookup?
The LOAD-LOOKUP command defines an array containing a set of keys and values and loads it into memory. With
LOAD-LOOKUP, you can reduce the number of tables that are joined in one SELECT. Use this command in
conjunction with one or more LOOKUP commands.
Syntax: begin-setup
load-lookup
name=prods
table=products
key=product_code
return_value=description end-setup
Can Multiple Columns be retrieved in LoadLookup command in SQR?
Yes, it has to be joined by a double pipe symbol ( || ).
If I get a duplicate key warning message when SQR loads a lookup table, will the lookup table still work correctly. No. Use
of a lookup table is dependent on not having duplicate keys.


How do you Define arrays in SQR ?
Ans: Syntax: #define array-size 50
Begin-Setup
CREATE-ARRAY NAME=<arrayname> SIZE=<size>
FIELD=<fieldname>:<DataType>:<Size> End-Setup
How do you Fetch values from Arrays in SQR? Get & Put is
used for inserting values in array.
2. Is it possible to increase the array size once defined? No, it is not possible to increase the Array size once defined

What is the difference between Arrays & Loadlookup?
Which is faster, a database join or LOAD-LOOKUP? It depends on your PROG.
LOAD-LOOKUP improves performance in the following situations:
When it is used with multiple SELECTS.
When it keeps the number of tables being joined from exceeding three or four.
When the number of entries in the LOAD-LOOKUP table is small compared to the number of rows in the SELECT,
and they are used often.
When most entries in the LOAD-LOOKUP table are used With LOAD-LOOKUP,
Ucan reduce the number of tables that are joined in one SELECT. Use this command in conjunction with one or
more LOOKUP commands.
The LOAD-LOOKUP command defines an array containing a set of keys and values and loads it into memory. The
LOOKUP command looks up a key in the array and returns the associated value. In some PROGs, this technique
performs better than a conventional table join.
You can use LOAD-LOOKUP in the SETUP section or in a procedure. If used in the SETUP section, it is processed
only once. If used in a procedure, it is processed each time it is encountered Arrays :
An array is a unit of storage that consists of rows and columns and exists in memory.
An array is similar to a database table, but it exists only in memory.
In Arrays we contains the data in load lookup array contains the set of keys and associated values.
What is the difference between Arrays & Loadlookup?
Arrays: An array is a unit of storage that consists of rows and columns and exists in memory. An array is
similar to a database table, but it exists only in memory.
Loadlookup: Function Loads an internal table with columns from the database. Allows for quick search using the
LOOKUP Usually this type of lookup can be done with a database join, but joins take substantially longer.
However, if your report is small and the number of rows to be joined is small, a lookup table cannot be warranted,
and in fact can be slower, since the entire table has to be loaded and sorted for each report run.
Syntax In the SETUP section:
LOAD-LOOKUP
NAME = lookup_table_name TABLE = database_table_name KEY = key_column_name
RETURN_VALUE = return_column_name
[ ROWS = initial_row_estimate_int_lit ] [ EXTENT = size_to_grow_by_int_lit ]
[ WHERE = where_clause_txt_lit ] [ SORT = sort_mode ] [ CURSOR = cursor_int ] [ QUIET ]



What are the different types of Arrays in SQR?
Single dimensional, and 2 dimensional, 3 dimensional array.
3 DA used in generating the (depend, job, summary salary) of employee
2 DA used in generating the customer details and order details
1 DA company id
15. How you can declare 2
nd
dimensional Arrays? Using multiple arrays can allow you to reduce
database calls. In the SETUP section, two arrays are createdone to summarize monthly orders by
product, and another to summarize monthly orders by price range.
BEGIN-SETUP create-array name=order_qty size={max_products}
field=product:char field=month_qty:number:3
create-array name=order_qty2 size={max_categories}
field=category:char field=month_qty:number:3 END-SETUP
How you can declare 2
nd
dimensional Arrays?
Create array Name : purchage array size = 100 Field1: price:num Field2: qty :num
create-array name=order_qty size={max_categories} field=category:char
field=month_qty:number:3


How do you Use XLATT table in SQR ?
a) Include ReadXlat.sqc. b) Put values into $fieldName, $fieldValue c) Call procedure read-translate-table
d) Get $XLATLongName & $XLATShortName from XLATTABLE of PS database.






Difference between SQR/Crystal/nVision ?
SQR ReportCrystal ReportNVision ReportGUI It does not provide GUI interface to create reports. It provides GUI Interfacefor creating reports.
It provides GUI Interface for creating reports.Interface writing. Uploading/Downloading data from flat file to PS & vis-a-versa.Cannot be
used for Interface writing.Cannot be used for Interface writing.Programming Language SQR language for reporting is a programming language
in which you can create your own SQCs libraries for reusability & also you can hold intermediate data for processing etc. You cannot write
complex programs, at the most you can use few If-Else statements based on the data fetched. You cannot hold intermediate data.Only prints
reports based on PSQueries. Excel Specific Output SQR Report output can be on text file, word document etc. Crystal Reportoutput can be of
any type.It provides output only for Excel spreadsheets.
What is a difference between EDIT & Format in SQR?
EDIT is used for formatting while printing & Format is usedwhile Input especially for date.
How do you make a zero value blank on a report? Print #varname (+1, 1, 10) EDIT bbb9
Mostly used Format commands in SQR:
CENTER: Center text
EDIT: uses masks to control the format of the output
FILL : fills the specified length with characters specified.
ON-BREAK: allows you to specify an action/procedure in tabular reports when break occurs in the value of the field.
BEGIN-SETUP includes following commands:
Ask : Prompts the user for substitution variable.
BEGIN-SQL : Begins an SQL paragraph.
CREATE-ARRAY: Creates an array of fields to store and process data
DECLARE-CHART: Defines attributes of a chart.
DECLARE-IMAGE: Defines the type, size and source of an image.
DECLARE-LAYOUT: Defines attributes of a report layout.
DECLARE-PRINTER : Overrides the printer defaults.
DECLARE-PROCEDURE
DECLARE-REPORT: Defines reports and their attributes.
DECLARE-VARIABLE : Allows user to explicitly declare a variable name.
LOAD-LOOKUP : Loads columns into an internal array.
USE : Overrides default database (Sybase and MSSQLServer only)
Types of PRINT commands? Function Puts data on the page at a specified position.
PRINT { any_lit | _var | _col } position
position means:
BOLD causes the string or number to be printed in bold type. EXP:print &name (+1, 20) bold
BOX Draws a one-line deep graphical box around the printed data.
EXP print &grand_total (+5, 20) box
CENTER Centers the field on a line. EXP :print Quarterly Sales (1) center
EDIT edit_format EDIT causes each field to be edited before it is printed.
EXP print #total (7,55,0) edit $999,999.99 ! $ 12,345.67

What are the different types of PRINTER commands?
Note the use of the ALTER-PRINTER command. This command changes the font in which the report is printed. declare-report
labels layout=labels printer-type=ps end-declare
The first method is to use the -PRINTER:xx command-line flag,
which specifies the output type for your report. Use the following commands:
DECLARE-PRINTER take effect only when you print your report with the printer you specify with the TYPE argument.
-PRINTER:LP for line-printer output -PRINTER:PS for PostScript output -PRINTER:HP for HP LaserJet output -
PRINTER:WP for Windows output -PRINTER:HT for HTML output.
If you are using the system shell, enter the following on the command line:
sqr test username/password -printer:ps




Common Flags used for SQRs
-A : Causes reporting output to be appended to an existing file of the same name.
-C : Cancel dialog box appears so that user can terminate the program.
-DEBUG: Used in conjunction with #debug command to display additional information when troubleshooting SQR programs.
-E : Specifies that an error file be created and allows you to specify the filename.
-I : Location of *.SQC or other include program files.
-F : Specifies a file or directory where the *.lis file should be created, instead of in the default location.
-O : Filename for the log file.
-RS : Creates a runtime version of your SQR. Creates a file with the *.sqt extention. PeopleSoft does not use
runtime SQR programs.
-M :SQR configuration file. Used to modify default SQR properties(AllMaxes.max)
-PRINTER : Causes printer type to be specified.
-S :Displays the status of the all cursors at the end of the run. This is used for troubleshooting SQR programs.
-Tnn : Specifies you to run SQR in test mode for the specified(nn) number of pages.
-CB : Forces communication box.
-XCB :Do not use communication box. Request for input will be made in Windows dialog boxes.
SQR provides internal, reserved variables with values maintained & updated by SQR.
#Current-Line : Current physical line on a page
$Current-Date : Current date time on the local machine when sqr is running.
#Current-Column : Current column on page.
#Page-Count : Current page number (can be reset).
#End-File : set to 1 if end of file occurs.
#Return-Status : value returned to operating system when sqr exits.
#Sql-Count : The # of rows affected by an SQL DML statement.
#Sql-Status : Status value from database after each query is compiled/executed. This value is database dependent.
$Sqr-Database: The database type for which SQR was compiled. Valid values are ORACLE, INGRES, DB2, INFORMIX, SQLBASE,SYBASE and ODBC.
$Sql-Error: Text message of error returned from DBS.
$Sqr-Locale : The name of the current locale being used.
#Sqr-pid: The process ID of the current SQR process.
$sqr-platform: The hardware/operating system type for which SQR was compiled. Valid values are WINDOWS, VM,MVS,WINDOWS-NT, UNIX,
VMS.
$sqr-program: The name of SQR program file.
$sqr-ver: The text string shown with -ID flag.
Functions (Most commonly used)
Isnull- Returns a value of 1 if source_val is null, otherwise returns a value of 0.
Instr- Returns the numeric position of sub_value in source_value or 0 if not found.
Length- Returns the number or characters in source_value.
Lpad- Pads the source_value on the left to a length of length_value using pad_value and returns the result.
Ltrim- Trims characters in source_value from the left until a character is not in set_value and returns the result.
Nvl- Returns y_value if the x_value is null, otherwise returns x_value.
Example: let $city = nval(&city, -- not city -)
Round(#avg_length,0)
Substr- Extracts the specified portion of source_value.
To_char- , To_Number,
String-This creates a string, Opposite of this is Unstring
Extract-Copies a portion of a string into string variables generally used in file manipulations. Example: EXTRACT
$area_code from &home_phone 0 3
Print is most commonly used stmt. Show and Display are also used
Evaluate
Example: EVALUATE<variable>
WHEN = <value> WHEN = <value> WHEN-OTHER <default SQR command(s)> END-EVALUATE
What is the difference between sqr and sqc?
SQR SQC
1. This is nothing but the Actual Source program. 1. This is like a function in SQR.
2. This consists of Program Section. 2. This does not consists of program Section.
3. This can be Compiled & Executed. 3. This cannot be Compiled and Executed.
4. We cannot call one SQR from another SQR or SQC.. 4. We can call one SQC from another SQC or SQR program

What is sqc? SQCs are nothing but some functions in SQR.here, we have reusable code, by including those SQCs
and calling those functions in our SQR program we can get the functionality of that function.
What is SQC, List out some of them?
SQC is used as Functional Library mainly used to re-use code and get some predefined functionalities used for our SQR programs.
Some of the Important SQC are
STDAPI.SQC, SETENV.SQC ,RESET.SQC, SETUPxx.SQC, NUMBER.SQC, STRING.SQC, DATETIME.SQC etc..

What is the purpose of SQCs?
We can define the function in sqc's ,then call the sqc's in sqr PROGs like c and c++ header files.
Structure query copy book is library used in SQR PROGs as #include setenv.sqc
#Include 'datetime.sqc' !Routines for date and time formatting
#Include 'curdttim.sqc' !Get-Current-DateTime procedure #Include 'number.sqc' !Routines to format numbers
3. What are the different types sqcs?
setenv.sqc, datetime.sqc, number.sqc, sysaudit.sqc, dddaudit.sqc, sysquery.sqc, sysrecord.sqc, syssql.sqc,
systree.sqc, sysversn.sqc, sysxlatt.sqc, reset.sqc, sysae.sqc, sysfield.sqc, sysmenu.sqc, syspage.sqc,
dddtable.sqc, dddviews.sqc, dddindex.sqc, curdttim.sqc

What procedures are defined in PRCSAPI.SQC & PRCSDEF.SQC?
PRCSAPI.SQC: Get-Run-Control-Parms(), Get-Process-Language(), Update-Prcs-Run-Status().
PRCSDEF.SQC: Define-Prcs-Vars() This procedure will define and initialize the various process scheduler variables.

STDAPI.SQC is mainly used to make our SQR program API aware.ie; we can see the status of that SQR program in process
monitor. This is a Process Scheduler Interface sqc which is used to initiate and terminate some field values such as
Process_instance & Run_cntl_id
SETENV.SQC?
This is used to set the Default Environment based on the Database such Printer Type, Paper Size, Date formats Etc.
Some of the most commonly used SQCs are..
1. STDAPI.sqc: This Is Process Scheduler Interface which is used to initiate and terminate some field values such as
Process_instance & Run_cntl_id
2. SETENV.sqc: This is used to set the Default Environment based on the Database such Printer Type, Paper Size,Date
formats Etc.
3. NUMBER.sqc : This file contains generalized routines to format numbers.
4. DATETIME.sqc : This file contains generalized routines to format dates and times. 6.RESET.sqc : This is
an important Footing SQc.



Standard SQCs
y Askftd.sqc - This asks from/thru date for reporting of heading
y Askaod.sqc - Procedure to call is Ask-As-of-Date
y CurDtTim.sqc - Gets the Current Date Time from System
y DateTime.sqc - Convert date from system format calling InitDate-Time procedure to set format.
y DateMath.sqc - Converts Native Date format to YYYY-MM-DD.
y Eoj.sqc - determines End of job for an SQR report.
y FSHdg01.sqc,FSHdg04.sqc - for Standard Headers for PS Financials.
y Number.sqc - Provides Number related Functions
y Opsys.sqc - Operating system settings.
y PrcsApi.Sqc - Used in Process Scheduler SQR Programs, to get Run control parameters
y RDBMS.sqc - Database Settings. These files uses #DEFINE command to set the variables.
y ReadXlat.sqc - Read the Translate Table for the desired values (Very Important)
y Reset.sqc - Used for Footing Section that prints End-of-Report.
y SetEnv.sqc - Sets Environment for Country, Printer-Paper, Language, Date, Platform specific parameters, It also contains
Opsys.sqc, RDBMS.sqc
y Setup01.sqc - This is generally called from Begin-Setup section for Portrait Size
y Setup02.sqc - This is generally called from Begin-Setup section for Landscape Size
y STDHDGTR.sqc - Performs Language Conversion
y STDHDG01.sqc - Provides Standard heading for language conversion
y StdApi.sqc - Gets Std API calls
y Trancntrl.sqc - Purpose is to COMMIT, ROLLBACK etc. across DB platforms
y Convertcurrency.sqc
y AllMaxes.max - It is used for dynamic memory allocations before the execution of SQR.


What is the SQC used to read data from translate table? READXLAT.sqc is the SQC used to read data from Translate Table.
How will you display an IMAGE in SQR? Using DECLARE-IMAGE , END-DECLARE command.

What is a Syntax for using SQC's in SQR? #include 'setenv.sqc'.
Which SQC file is used for From Date and To Date. AskEfdt.sqc
Which SQC tells you that some Job is completed? Eoj.sqc tells you about that.
Which SQC is responsible for system memory allocations? AllMaxes.max

How to Avoid double declaration of an SQC file? To check this writes all procedure of an SQC in the following:
#Ifdef <constant> #define <constant> <write all procedures of an sqc file> #endif
What SQC is found in every PeopleSoft SQR program? : SetEnv.sqc
What SQC files are commonly included in almost all PeopleSoft SQR programs?
CurDtTim.sqc, Number.sqc and Reset.sqc.
Which SQC file should be modified to include your standard company heading ?
XxHDG01.sqc where xx is for either HR for Human Resource or FN for Financials.
What are the most common uses of SQC files ?
a) Setup Section b) Standard Headings Footing Section User prompts
Get related data Process Scheduler processing
How can I suppress display of the SQR banner line when running SQR? Use the -XB flag.





STDAPI : Process Scheduler Interface
DESCRIPTION: It can be used in other SQRs by performing a "do STDAPI-INIT" "do STDAPI-TERM"
#Include 'stdvar.sqc' !Updates process scheduler status
STDAPI: Standard Variables
begin-procedure Define-Standard-Vars let $Payroll_NID_Type = 'PR' end-procedure
#Include 'prcsdef.sqc' !Update Process Request variable declare
#Include 'prcsapi.sqc' !Update Process API
#Include 'eoj.sqc' !Updates process scheduler status

PrcsDef : Procedure to define the Process Scheduler variables.
DESCRIPTION: It can be used in other SQRs by performing a "do Define-Prcs-Vars"
PrcsAPI : Procedure to update the Process Scheduler request record and get the run control parameters.
DESCRIPTION: It can be used in other SQRs by performing a
"do Get-Run-Control-arms" "do Update-Prcs-Run-Status"
(We need to indicate that we're in Update-Prcs-Run-Status because if there is an error that goes to SQL-Error (sqlerr.sqc), that
will try to call back here. If the error came from here, though it would be an infinite loop in all likelihood. So, we set the
indication to prevent the call back here.)
SQLERR : SQL Error Handling Procedure
This procedure is typicallly called via the ON-ERROR condition of BEGIN-SQL and BEGIN-SELECT.
"do Update-Process-Status" "do Get-PrcsRqst-Info" "Get-Job-Instance"
do Get-Last-Message-Seq do Process-Message-Log do Check-Message-Parms
do Parse-Message-Parms do Insert-Message-Log do Insert-Message-Log-Parm
do Set-Client-Info do MS-Set-Client-Info
EOJ : Perform end of job processing if successful status #include "tranctrl.sqc"
DESCRIPTION: It can be used in other SQRs by performing a "do Successful-EOJ"



SETENV : #include 'rdbms.sqc'--- (Database Environment) #define ORACLE
#include 'opsys.sqc'----(Operating System Environment)
#define AXP #define MVS #define NT #define OS400 #define UNIX #define VAX #define VMS
!BasePeopleTools Version !Country !Printer
!Process Schedulder OUTDESTTYPE (ODT) !Process Schedulder OUTDESTFORMAT (ODF)
! Print Specific Language !Paper Size !Language ! File prefixes and suffix
#ifdef NT
#define FILEPREFIX C:\TEMP\
#define FILESUFFIX
#end-if
!
#ifdef MVS #define FILEPREFIX #define FILESUFFIX #define EBCDIC
#end-if
!Return Status
#define GOOD-OS-STATUS 0

!Global Date Defines
#define DEFMDY 'MDY' #define DEFDMY 'DMY' #define DEFYMD 'YMD
#define DEFDATE 'DATE' #define DEFCMP 'CMP' #define DEFROM 'ROM' #define DEFKAN 'KA ! PTRPTYear -
Used in determining what format to display the year in. This does not affect the format used to talk to DB)
! Meta SQL (For Use in SQL Statements Only) ! Standard INFORMIX parameters
! Meta SQL (For Use in SQL Statements Only)
!
#define PTConCat || #define PTTRUNCATE DELETE FROM #define PTSubStr substr
! Standard MICROSOFT parameters
! Meta SQL (For Use in SQL Statements Only)
!
#define PTConCat + #define PTTRUNCATE TRUNCATE TABLE #define PTSubStr substring

! Standard ORACLE parameters
! Meta SQL (For Use in SQL Statements Only)
!
#define PTConCat || #define PTTRUNCATE TRUNCATE TABLE #define PTSubStr substr
TRANCTRL : Common Transaction Control Procedures
DESCRIPTION : The purpose of this SQC is to support COMMIT, ROLLBACK, etc., across platforms. For
example, it can be used in other SQRs by performing a "do Commit-Transaction" rather than a "commit".
How can you send a mail to person?
If this is AE, The command used to send email is.. If this is SQR, the command used to send email is .. ..
For this to happen, we have to have mail server set in Unix box.
For WF, I did set up the WF in such away that is send email to a person or group by settings the
properties in a business process, Activity and Event where in I gave the email address of the person or
used a Role Query.Iused PeopleCode at component level or Record level to Trigger the WF. I know how
to create Role queries,develop Business process,set WF or Worklist. Using activity ,event and
mail setting the properties and connected by routing, I write a WF PeopoleCode using
TriggerBusinessEvent function I can send a mail.
Can we Change the login id of other DB using SQR?
Using CONNECT Function Logs off the database and logs on under a new user name & password.
Syn:CONNECT { txt_lit | _var | _col }[ ON-ERROR= procedure [ ( arg1 [, argi ] .. )] ]
Arguments
txt_lit | _var | _col Specifies a user name and password for the logon.
ON-ERROR Specifies a procedure to be executed if the logon fails. If no ON-ERROR procedure is
specified and the logon fails, SQR halts with an error message.
You can optionally specify arguments to be passed to the ON-ERROR procedure.
Arguments can be any variable, column, or literal.
Description: The new user name and password can be stored in a string variable, column, or literal.
After each CONNECT, the reserved variable $username is set to the new user name.
All database cursors or logons are closed before the CONNECT occurs. You should not Issue a
CONNECT within a SELECT or an SQL paragraph while a query is actively Fetching or manipulating
data from the database. CONNECT SQR 4.0
Examples: Connect $new-user on-error=bad-logon($new_user)
Connect sqr/test, Warning the username/password is not encrypted, so beware of security issues.
The SETUP section, if present, is typically placed at the top of the PROG before the PROG section. It begins with BEGIN-SETUP and
The following commands can be issued in the SETUP section. If used, they r processed at compile time, before the PROG
begins executing. Command Comments
ALTER-LOCALE Can also appear in a procedure, ASK Allowed only in SETUP section.
BEGIN-SQL Can also appear in a procedure. Executed when a run-time file (.SQT) is loaded.
CREATE-ARRAY Can also appear in a procedure.
DECLARE-CHART DECLARE-IMAGE DECLARE-LAYOUT DECLARE-PRINTER
DECLARE-PROCEDURE DECLARE-REPORT
DECLARE-VARIABLE Can also appear in a local procedure. LOAD-LOOKUP Can also appear in a procedure.
USE SYBASE only.

In SQR functions parameters are passed by Reference or value?
Objects are passed by reference and variable assigned values are passed by values.
19. What Are The Application Libraries? In AE this is the one type Prog, like header files in sqr , c and c++
,These apllication Libraries are with out having MAIN section.

4. How many types you Run SQRs? 1. Using SQRW (in TwoTier) 2.Using Process scheduler
3.In UNIX, you can run the SQR Using Shell Scripts.
17. How does u represent variables in sqr? Variables - $ Numeric - # Field Values - &
How you can declare Dynamic variables in SQR? Dynamic variables by enclosing them in square
brackets. For example, [$col1] ,[$col2] : At run time,Dynamic variable should be on [ ]
You can also use Dynamic SQL in some situations to simplify a SQL statement and gain performance.
Dynamic SQL enables you to check the value of $state and create the simpler condition:
if $state = 'CA' let $datecol = 'order_date' else let $datecol = 'ship_date' end-if
begin-select order_num from orders, customers
Where order.customer_num = customers.customer_num and [$datecol] > $start_date end-select
The substitution variable [$datecol] substitutes the name of the column to be compared with $state_date.
The SELECT is simpler and no longer uses an OR. In most cases, this use of dynamic SQL improves
performance.
16. Can we create table-using sqr? Yes, using sqr begin-sql & end-sql section only in set-up section.
In procedure section only dml commands can be given.
12. How you can Update values by using SQR?
In beging sql write update table name set where coloum name with out set condition total table will be
updated. Write in Begin-select using update commad end-select
16. About Begin SQL :Function Begins an SQL paragraph. This paragraph can reside in a
BEGIN-PROCEDURE, BEGIN-SETUP, or BEGIN-PROG section. Examples
Begin-Sql update orders set invoice_num = #next_invoice_num
where order_num = &order_num end-sql begin sql
delete orders where order_num = &order_num;
insert into orders values ($customer_name, #order_num,...) End-Sql

Can we write Insert and Update in a single Begin SQL section. May be
What is the use of SkipLine? Further enhance the visual effect of break processing by inserting
one or more lines between groups. To do so, use the SKIPLINES qualifier with ON-BREAK&
The SKIPLINES=1 argument skips one line between records, then renumbers the current line as line 1.


Can I write a matrix report in SQR? Yes. Example of a SQR cross-tab (matrix) report
Example:
Begin-Setup Page-Size 60 133
declare printer type = postscript orientation = landscape line-size = 8 char-size = 6 End-Setup
MULTIPLE REPORTS***************
How many DECLARE-PRINTER commands can a program have?
At the most, one for each printer type (lp, hp, ps) for each report plus one declaration for 'default-lp', one for
'default-ps' and one fordefault-hp'. SQR will produce an error message if you declare two hp printers for the same
report (or two ps printers, etc.). SQR will issue an error if you define 'default-ps' twice, etc.
Do I have to have the DECLARE-LAYOUT before a DECLARE-REPORT that uses it?
No, you can have them in any order.
How do I have different reports generate output for different printers in the same program?
U have to place an appropriate USE-PRINTER-TYPE after the corresponding USE-REPORT.
Example:
begin-program use-report listing use-printer-type ps use-report labels use-printer-type hp
use-report form_letter use-printer-type lp do main end-program
What's the effect of the -PRINTER command line flag in a multiple report program?
It overrides the printer type for all the report.
How can unique temporary file names be generated in SQR ?
One technique is to combine the report name (minus the extension) with the system process ID. The SQR pre-defined variables
$sqr-report and #sqr-pid are used. The following example will create a temporary file named techtip1234.tmp for program
techtip.sqr ran as process ID 1234. The temporary file is deleted at the end of the procedure.
What is Declare-Layout <layoutname> used for? It is used for defining Page Layout & includes Paper Size,
Margins in Begin-Setup. Such as Left-Margin = 1, Top-Margin=1.
What is Master Detail Report? Report where tables with one to many relationships are involved. Project,
Tasks, Resources, Efforts. On-Break Level =1 etc.

How do you print a document/letter using SQR? Using Begin-Document, End-Document in a procedure. Call this
procedure before From Clause in Begin-Select to print for each record.

How does SQR calculate the number of rows available for the body of the page?
The rows available to the body of your report are calculated from the rows defined in PAGE-SIZE minus the number
of rows reserved by the BEGIN-HEADING and BEGIN-FOOTING sections.

Which SQL command is not allowed in the BEGIN-SQL paragraph? SELECT
What will happen if you do not include an ON-ERROR=procedure in a BEGIN-SQL if your program encounters an SQL error or
warning? SQR program will abort.
Which table stores the translated static report values? The Strings Table.
What type of variable does the INPUT command use? The INPUT command always inputs into a TEXT variable.







What are On-break parameters? ON-BREAK causes the specified action to perform in a tabular report when the
value of a field changes. The default action prints the field only when its value changes (PRINT=CHANGE).Mainly
used for Redundancy of Printing on a page.
What the use of ON-Break in SQR ? Usage: It is used to group set of records for each level & break at each level.
Syntax: ON-Break Level=1 skiplines= 4 After = ProcedureName vcc
What is the BREAK command used for within a WHEN clause of the EVALUATE command ?
The BREAK command ends the EVALUATE at that point.
What is the difference between the parameters for the EXTRACT command versus the LET/SUBSTR command?
The EXTRACT command uses the offset 0 as the first position. The LET/SUBSTR command uses 1 as the first position.
What is Extract in SQR? Extract copies a portion of string into a string variable & substring is to extract a string
from a string variable.

What must you remember to program into a WHILE loop? u must increment your WHILE loop counter.
What are the restrictions governing where a GOTO label can be placed? GOTOs and their labels must be in the same Section
or Paragraph. Labels must be left justified and GOTO label must end with Colon(:)

How do we Convert Number to String in SQR?
Using To char function or even by assigning. #var is numeric, $var is string.

How do we Concatenate String in SQR? Using Concat function or || as pipes.
How do you Declare a local procedure in SQR? Using Begin-Procedure <procedurename> local
How do you know in SQR on which cursor position you are residing? : #Cursor-pos
What is STOP QUIET used for in SQR? Stops execution of SQR & come out of it.

How do you refer to a Constant in SQR? A constant is referred in curly braces { }.
How do you put a blank line in Begin-Document End-Document? Using .b
How do you Enter a line in an SQR? Print - (y,x,100) FILL
How to place a corporate logo in sqr? Using Declare Image command
How do you Place a Date into Heading Section of SQR?
Use Date-Time function in SQR & Page-Number.
How can I reset the page number that is printed with the PAGE-NUMBER command?
: Move the desired value to the #PAGE-COUNT reserved variable. For example: move 1 to #page-count.
How do you accept Date variable as an Input from a user ? Input $Fieldname type-date format dd/mm/yyyy








Exporting Data to Other Applications
Using SQR, We create an export file, which you can load into a document such as a spreadsheet. The tabs create
columns in your spreadsheet or word processing document that correspond to the columns in your database table.
begin-setup
! No margins, wide enough for the widest record ! and no page breaks
declare-layout default left-margin=0 top-margin=0 max_columns=160 formfeed=no
end-declare end-setup
begin-program do main end-program

begin-procedure main encode '<009>' into $sep ! Separator character is TAB
let $cust_num = 'Customer Number' let $name = 'Customer Name' let $addr1 = 'Address Line 1'
let $addr2 = 'Address Line 2' let $city = 'City' let $state = 'State' let $zip = 'Zip Code'
let $phone = 'Phone Number' let $tot = 'Total'
string $cust_num $name $addr1 $addr2
$city $state $zip $phone $tot by $sep into $col_hds
print $col_hds (1,1) new-page
begin-select cust_num name addr1 addr2 city state zip phone tot
string &cust_num &name &addr1 &addr2 &city &state &zip &phone &tot by $sep into $db_cols
print $db_cols () new-page from customers end-select end-procedure ! main
Dynamic SQL
Find the restriction against using variables where only literals are allowed somewhat restrictive. The ordering of the records changes based on
the users selection. The program runs the SELECT twice. The first time, the first column is called name and the second column is called city, and
the program sorts the records by name with a secondary sort by city. The second time, the first column is the city and the second is name, and
the program sorts by city with a secondary sort by name.
begin-program
let $col1 = 'name' let $col2 = 'city' let #pos = 32
do list_customers_for_state
position (+1)
let $col1 = 'city' let $col2 = 'name' let #pos = 18
do list_customers_for_state
end-program

begin-procedure give_warning display 'Database error occurred' display $sql-error end-procedure ! give_warning

begin-procedure list_customers_for_state
let $my_order = $col1 || ',' || $col2
begin-select on-error=give_warning
[$col1] &column1=char (,1) [$col2] &column2=char (,#pos)
position (+1)
from customers order by [$my_order] end-select end-procedure ! list_customers_for_state
Mailing Labels : A SQR SELECT paragraph retrieves the addresses and prints them on the page. Sometimes you need to print labels in
multiple columns. The page then becomes a matrix of rows and columns of labels. SQR enables you to print in column format with the commands
COLUMNS and NEXT-COLUMN in conjunction with NEXT-LISTING.
#define MAX_LABEL_LINES 10 #define LINES_BETWEEN_LABELS 3
begin-setup declare-layout default paper-size=(10,11) left-margin=0.33 end-declare end-setup
begin-program do mailing_labels end-program

begin-procedure mailing_labels
let #label_count = 0 let #label_lines = 0 columns 1 29 57 ! enable columns alter-printer font=5 point-size=10
begin-select
name (1,1,30) addr1 (2,1,30)
city state zip
move &zip to $zip XXXXX-XXXX
let $last_line = &city || ', ' || &state || ' ' || $zip
print $last_line (3,1,30)
next-column at-end=newline
add 1 to #label_count
if #current-column = 1 add 1 to #label_lines
if #label_lines = {MAX_LABEL_LINES}
new-page let #label_lines = 0
else
next-listing no-advance skiplines={LINES_BETWEEN_LABELS}
end-if end-if from ps_customers end-select
use-column 0 ! disable columns
new-page
print 'Labels printed on ' (,1) print $current-date () print 'Total labels printed = ' (+1,1)
print #label_count () edit 9,999,999 end-procedure ! mailing_labels
MailMerge Documents
begin-program do main end-program
begin-procedure main begin-select name addr1 addr2 city state zip
do write_letter
From customers order by name end-select end-procedure ! mainbegin-procedure write_letter
begin-document (1,1) &name &addr1 &addr2 @city_state_zip
.b
.b
$current-date
Dear Sir or Madam:
.b
Thank you for your recent purchases from ACME Inc. We would like to tell you about our limited-time offer. During this
month, our entire inventory is marked down by 25%.
.b
Sincerely,
Clark Axelotle ACME Inc.
end-document
position () @city_state_zip print &city () print ', ' () print &state () print ' ' ()
print &zip () edit xxxxx-xxxx new-page end-procedure ! write_letter



ASK command prompts the user for the value of the substitution variable {my_order}, which is used to
sort the output.

Using DML and DDL: DDL can be given only in SET-UP section only.

begin-setup
begin-sql on-error=skip ! table may already exist
create table customers_ext (
cust_num int not null,
name varchar (30),addr1 varchar (30),addr2 varchar (30),
city varchar (16), state varchar (2), zip varchar (10), phone varchar (10),tot int
)
end-sql end-setup
begin-program do main end-program

begin-procedure main #if {sqr-database} = 'Sybase'
begin-sql begin transaction end-sql
#endif
Encode '<009>' into $Sep Open 'ex11a.lis' as 1 for-reading record=160:vary
read 1 into $rec:160 ! Skip the first record, column headings while 1 read 1 into $rec:160
if #end-file
break
end-if
unstring $rec by $sep into $cust_num $name $addr1 $addr2 $city $state $zip $phone $tot
move $cust_num to #cust_num
move $tot to #tot
begin-sql
insert into customers_ext (cust_num, name,addr1, addr2, city, state, zip, phone, tot)
values
(#cust_num, $name, $addr1, $addr2, $city,$state, $zip, $phone, #tot)
end-sql end-while
#if {sqr-database} = 'Sybase'
begin-sql commit transaction end-sql
#else
#if {sqr-database} <> 'Informix'
begin-sql commit end-sql #endif #endif close 1 end-procedure ! main

dateadd(&invoice_date,'day',30) < datenow()
datediff(datenow(),&invoice_date,'day') > 30
&invoice_date < dateadd(datenow(),'day',-30)
&order_date > strtodate('3/1/1999','dd/mm/yyyy')
if strtodate(datetostr(&order_date,'dd/mm/yyyy'),'dd/mm/yyyy') >
strtodate('3/1/1999','dd/mm/yyyy')
input $start_date 'Enter starting date' type=date format='dd/mm/yyyy'
print &order_date () edit As of Month dd, YYYY



Best Of Luck
With Regards, Venkatareddy.gade@gmail.com

Potrebbero piacerti anche