PeopleCode to retrieve Google map between two addresses

 

PeopleCode Example:

/* Define constants for the API request */

Local string &origin = "123 Main St, Anytown, USA";  /* Replace with the starting address */

Local string &destination = "456 Elm St, Othertown, USA";  /* Replace with the destination address */

Local string &apiKey = "YOUR_GOOGLE_MAPS_API_KEY";  /* Replace with your Google Maps API Key */

 

 

/* Construct the Google Maps API URL */

Local string &baseUrl = "https://maps.googleapis.com/maps/api/directions/json?";

Local string &url = &baseUrl | "origin=" | %EncodeURL(&origin) | "&destination=" | %EncodeURL(&destination) | "&key=" | &apiKey;

 

/* Create an HTTP request object */

Local object &http = CreateObject("HttpClient");

Local integer &status;

 

/* Send the HTTP GET request */

&status = &http.Get(&url);

 

/* Check if the request was successful */

If &status <> 0 Then

   /* Handle error */

   MessageBox(0, "", 0, 0, "Error sending request to Google Maps API: " | &http.GetLastError());

Else

   /* Parse the JSON response */

   Local string &response = &http.GetResponseText();

   Local object &jsonResponse = JSON.Parse(&response);

  

   /* Check if the response contains routes */

   If All(&jsonResponse.Routes) Then

      Local object &route = &jsonResponse.Routes[1];

     

      /* Retrieve route details */

      Local string &summary = &route.summary;

      Local string &distance = &route.legs[1].distance.text;

      Local string &duration = &route.legs[1].duration.text;

     

      /* Display the results */

      MessageBox(0, "", 0, 0, "Route: " | &summary | Char(13) | "Distance: " | &distance | Char(13) | "Duration: " | &duration);

   Else

      /* Handle no routes found */

      MessageBox(0, "", 0, 0, "No routes found between the specified addresses.");

   End-If;

End-If;

 

Example-2: Here you can use two strings as input parameter from page

Local string  &Fromaddr,&Toaddr;

&Fromaddr = SY_MAPS_INT_WRK.SY_FROM_LOCATION.Value;
&Toaddr = SY_MAPS_INT_WRK.SY_TO_LOCATION.Value;

&Map_Selection = “http://maps.google.com/maps?saddr=%FromAddr%&daddr=%ToAddr%&#8221;;
&Map_Selection = Substitute(&Map_Selection, “%FromAddr%”, &Fromaddr);
&Map_Selection = Substitute(&Map_Selection, “%ToAddr%”, &Toaddr);
ViewContentURL(&Map_Selection, True);


Advanced Integration Steps

Handling Different Travel Modes

Google Maps Directions API supports multiple travel modes such as driving, walking, bicycling, and transit. You can modify the request URL to specify a travel mode.

/* Define the travel mode */

Local string &travelMode = "driving";  /* Options: driving, walking, bicycling, transit */

 

/* Construct the Google Maps API URL with travel mode */

Local string &url = &baseUrl | "origin=" | %EncodeURL(&origin) | "&destination=" | %EncodeURL(&destination) | "&mode=" | &travelMode | "&key=" | &apiKey;

 

Optimizing API Requests

Waypoints: If you want to include intermediate stops in your route, you can add waypoints.

Local string &waypoints = "via:123+Main+St,Anytown,USA|via:789+Oak+St,Newtown,USA";  /* Example waypoints */

Local string &url = &baseUrl | "origin=" | %EncodeURL(&origin) | "&destination=" | %EncodeURL(&destination) | "&waypoints=" | &waypoints | "&key=" | &apiKey;

 

Departure Time: For transit mode, you can specify a departure time to get more accurate directions.

Local string &departureTime = "now";  /* You can also use a specific timestamp */

Local string &url = &baseUrl | "origin=" | %EncodeURL(&origin) | "&destination=" | %EncodeURL(&destination) | "&mode=" | &travelMode | "&departure_time=" | &departureTime | "&key=" | &apiKey;

 

Enhanced Error Handling

Implement more comprehensive error handling to deal with different types of errors, including network issues, invalid API responses, and more.

If &status <> 0 Then

   /* Handle HTTP errors */

   MessageBox(0, "", 0, 0, "HTTP Request Error: " | &http.GetLastError());

Else

   /* Parse the JSON response and check for API-specific errors */

   Local object &jsonResponse = JSON.Parse(&http.GetResponseText());

 

   If All(&jsonResponse.Status = "OK") Then

      Local object &route = &jsonResponse.Routes[1];

      /* Proceed with parsing and displaying route information */

   Else

      /* Handle API-specific errors */

      Local string &errorMessage = &jsonResponse.Error_message;

      MessageBox(0, "", 0, 0, "Google Maps API Error: " | &errorMessage);

   End-If;

End-If;

Data Parsing and Utilization

You can extract additional details from the API response, such as steps in the route, estimated arrival times, and more.

 

Local object &leg = &route.legs[1];

Local array of object &steps = &leg.steps;

 

For &i = 1 To &steps.Len

   Local object &step = &steps[&i];

   Local string &instruction = &step.html_instructions;

   Local string &stepDistance = &step.distance.text;

   Local string &stepDuration = &step.duration.text;

 

   /* Display or process each step in the journey */

   MessageBox(0, "", 0, 0, "Step " | &i | ": " | &instruction | " (" | &stepDistance | ", " | &stepDuration | ")");

End-For;

 

Security Enhancements

  • Secure API Key Storage: Store the API key securely within PeopleSoft, using configuration or encrypted storage options to prevent exposure in the codebase.
  • Use of Environment Variables: Instead of hardcoding the API key, use environment variables or secure PeopleSoft configuration values to inject the key at runtime.

User Interface Integration

If you want to display the map within a PeopleSoft page, you can embed a Google Maps iframe using the map URL. Alternatively, you can use JavaScript on a PeopleSoft page to display dynamic map content.

 

 

Sample Code for XML-to-JSON and JSON-to-XML Conversion

 import PT_INTEGRATION:CIRESTDefinition;


Local PT_INTEGRATION:CIRESTDefinition &oConvert = create PT_INTEGRATION:CIRESTDefinition();

Local string &sJSON, &sXML;

Local XmlDoc &xmlDoc, &retXmlDoc;


&sXML = GetHTMLText(HTML.XPPHTMLX);

&xmlDoc = CreateXmlDoc(&sXML);

&sJSON = &oConvert.convertXMLtoJSON(&xmlDoc);

WinMessage(&sJSON, 64);

REM XPPJSONX - create an HTML object and paste the JSON from above into this HTML so that it can be compared with the original XML;

&retXmlDoc = &oConvert.convertJSONtoXML(GetHTMLText(HTML.XPPJSONX));

WinMessage(&retXmlDoc.GenFormattedXmlString(), 64);

Generating LARGE JSON Files for your IB


The PeopleCode native JsonObject and JsonArray classes allow us to create JSON structures as in-memory representations. But what if you need to generate a really LARGE JSON structure? An in-memory JSON Array may consume more memory than you can reasonably allow. Fortunately, PeopleTools includes the Jakarta JSON library, which allows us to write a JSON structure to a stream during construction.

The following code snippet demonstrates creating 10 million JSON objects in an array without any change in memory consumption. The generated file was 2.5 GB in size, but my memory utilization didn't change the entire time the program ran.

Local JavaObject &Json = GetJavaClass("jakarta.json.Json");
Local JavaObject &writer = CreateJavaObject("java.io.FileWriter", "C:\temp\users-big.json");

Local JavaObject &gen = &Json.createGenerator(&writer);

Local number &iteration = 1;

REM ** 10 million iterations;
Local number &maxIterations = 10000000;

&gen.writeStartArray();

For &iteration = 1 To &maxIterations
   
   REM ** start person/user object;
   &gen.writeStartObject();
   &gen.write("id", "" | &iteration);
   &gen.write("firstName", "John");
   &gen.write("lastName", "Smith");
   
   REM ** start child address object;
   &gen.writeStartObject("address");
   &gen.write("streetAddress", "21 2nd Street");
   &gen.write("city", "New York");
   &gen.write("state", "NY");
   &gen.write("postalCode", "10021");
   &gen.writeEnd();
   
   REM ** start phone number array;
   &gen.writeStartArray("phoneNumber");
   
   REM ** start home phone object;
   &gen.writeStartObject();
   &gen.write("type", "home");
   &gen.write("number", "212 555-1234");
   &gen.writeEnd();
   
   REM ** start fax number object;
   &gen.writeStartObject();
   &gen.write("type", "fax");
   &gen.write("number", "646 555-4567");
   &gen.writeEnd();
   
   REM ** end array of phone numbers;
   &gen.writeEnd();
   
   REM ** end person/user object;
   &gen.writeEnd();
End-For;


REM ** end array;
&gen.writeEnd();

REM ** cleanup to flush buffers;
&gen.close();
&writer.close();

The hard-coded values come directly from the Jakarta generator API documentation. In real life, you would replace these values with database data. I converted numbers to strings to simplify the example to avoid Java Reflection.

Are you interested in parsing rather than generating large JSON files? Check out our post on JSON Stream Parsing.

We teach PeopleTools and PeopleCode tips like this every week! Check out our upcoming course schedule to see what we are offering next! We would love to have you join us. Want to learn at your own pace? Check out our subscriptions and on-demand offerings as well. Or do you have a group you would like to train? Contact us for group and quantity discounts.

PeopleSoft Technical Interview Questions

 

1) Explain what is PeopleSoft?

PeopleSoft is an organization that provides e-business application software over the internet.  It provides software for Human resource management, Supply chain management, CRM or Customer Relationship Management, Enterprise Performance Management and so on.

2) Explain what is Related Content in PeopleSoft?

In PeopleSoft, related content services are the framework within which administrators can contextually link application pages with collaborative content in any PeopleSoft application.

3) Mention what all technical things can PeopleSoft billing can do?

With this application of PeopleSoft many things can be done like

·        Create bills

·        Receive billing data from other PeopleSoft applications

·        Receive billing data from other applications

·        Create recurring bills, installment bills, inter &intraunit bills and so on

·        Review and validate bills

·        Adjust invoices

·        Calculate sales, use, and value-added taxes

·        Defer revenue accounting and so on

4) Explain how the voucher build process flow works in PeopleSoft?

The voucher build process consists of two sub-processes voucher edit and pre-edit.  The pre-edit sub-processes create skeleton voucher record sets from the partial information that you provided online using the components like Quick Invoice Entry (VCHR_QUICK_PNL) or the Summary Invoice Entry (VCHR_SUMM_PNL), or that it obtains from other sources.  After the pre-edit sub-process creates voucher record sets successfully, it calls the voucher edit sub-process to complete the record sets.

5) In people soft in what many ways you can run an application engine program?

You can run an application in five ways

  1. ·        Application designer
  2. ·        Process Scheduler
  3. ·        AE people tools
  4. ·        Calling people code
  5. ·        Command line prompt(dos)

6) Explain how you can export SQL results to Excel using SQLPLUS?

To export SQL results to Excel using SQLPLUS, you have to follow the following steps

·        Step 1: Login into data-base using SQL PLUS

·        Step 2: Set mark-up using command “ SET MARKUP HTML ON”

·        Step 3: Spool the output to a file “SPOOL C:\TEMP\MYOUTPUT.XLS”

·        Step 4: Execute your SQL QUERY

·        Step 5: Set the Spool off

·        Step 6: To view the output open the output XLS file

7) Explain what is People Soft integration broker?

People soft integration broker provides SOA (service oriented architecture) technology, and enables the transferring of asynchronous and synchronous service operations.  You can use the PeopleSoft integration broker to

·        To execute synchronous and asynchronous messaging among internal as well as third party systems

·        Delivers PeopleSoft business logic as web services to PeopleSoft and third-party systems

·        Invoke and consume web services from third party and PeopleSoft systems

8) Mention what are the two important components of PeopleSoft integration broker?

The two important components of PeopleSoft integration includes

·        Integration gateway: It is a platform that regulates the receipt and delivery of service operations passed among systems via PeopleSoft Integration Broker

·        Integration engine: It is an application server process that routes service operation to and from PeopleSoft application transforms service operation structure and translates data as per the specification

9) Explain what is the role of PeopleSoft component Interfaces?

PeopleSoft component interfaces give a way to use the PeopleSoft database without using a graphical user interface.  A component interface wraps PeopleSoft component, which is a logical grouping of PeopleSoft pages representing a complete business transaction.

10) Explain File Interfaces in PeopleSoft?

PeopleSoft interfaces provide the ability to exchange files with third-party system or legacy system that do not support messaging.  Files are exchanged using file layouts.

File Layouts supports following file types

  1. ·        Comma delimited files
  2. ·        Fixed format sequential files
  3. ·        XML files

11) Explain what does PeopleSoft query is used for?

PeopleSoft query is a way to generate ad-hoc and scheduled reports quickly from any source data stored in your PeopleSoft tables.  User can build and execute queries using any supported web browsers.

12) In what all ways you can use PeopleSoft Query?

PeopleSoft query can be used

  • ·        To display data in a grid
  • ·        To run queries as a discrete process
  • ·        To schedule a query
  • ·        To download query results to XML and Excel spreadsheet
  • ·        To cater as a data source for Crystal Reports
  • ·        To decide to whom to forward information
  • ·        To cater as a data source for defining online analytical processing cube (OLAP)
  • ·        To create a data source for PeopleSoft and Vision reports

13) Explain what is the use of Publish Utility in PeopleSoft?

The publish utility automates the procedure of copying the contents of the entire table into a legacy system or remote database.

14) Mention what is PeopleSoft Multi-Channel framework?

PeopleSoft multi-channel framework provides an integrated infrastructure to support multiple interaction channels for call center agents or other PeopleSoft users who must respond to notifications and incoming requests.  PeopleSoft multi-channel framework supports following channels.

  1. ·        Web collaboration (Chat)
  2. ·        Voice (Telephone)
  3. ·        E-mail
  4. ·        Instant Messaging

15) Mention what are the different types of service operation does PeopleSoft Integration Broker provides?

PeopleSoft integration broker supports four types of services

·        Asynchronous one-way

·        Asynchronous response/request

·        Asynchronous to synchronous

·        Synchronous

16) Mention where you can add a value to the underlying table in PeopleSoft?

In PeopleSoft, you can add a value into the “prompt table with no edit”.

17) Mention what are the tools are provided by PeopleSoft for testing your integration development?

The tools that are provided by PeopleSoft for testing your integration development

  • ·        Send master utility
  • ·        Simple post utility
  • ·        Automated integration point testing
  • ·        Transformation test utility
  • ·        Handler tester
  • ·        Schema tester

18) Mention what is the role of Schema Tester?

The Schema Tester utility allows you to validate rowset-based and non-rowset-based messages against message schemas during development to determine if messages link to defined message schemas.

19) Mention what does feed publishing framework provides?

Feed publishing framework provides

·        A set of API’s and code samples to assist application developers in making new types of feeds and synchronizing them with existing features

·        Unified interfaces for administrative users and content owners to create, configure and maintained feed definition of various types

·        Interfaces for end users to explore related feeds and search feed definitions

20) Explain in what ways you can create exceptions in PeopleSoft?

In PeopleSoft, exceptions are handled in two ways

·        Creating an exception base class that wraps the built-in function call and handles its function parameters consistently, which is more common way

·        By calling the built-in function CreateException

 

PeopleSoft Integration Broker Interview Questions And Answers

1) What is PeopleSoft Integration Broker?

A) PeopleSoft Integration Broker is a middleware technology that: Performs asynchronous and synchronous messaging among internal systems and third-party systems. Exposes PeopleSoft business logic as web services to PeopleSoft and third-party systems.

2) What are the most important subsystems of PeopleSoft Integration Broker?

A) PeopleSoft Integration Broker consists of two most important subsystems, they are:

Integration Gateway and the Integration Engine.

 

3) What are Integration Gateway and the Integration Engine in PeopleSoft Integration Broker?

A) The integration gateway resides on a PeopleSoft web server, and the integration engine is installed on an application server as part of the PeopleSoft application.

4) What are Web Services in PeopleSoft Integration Broker?

A) PeopleSoft Integration Broker enables you to provide web services to other PeopleSoft systems and external integration partners by generating Web Services Description Language (WSDL) documents and Web Application Definition Language (WADL) document from integration metadata.

PeopleSoft supports providing WSDL documents and WADL documents to the PeopleSoft WSDL repository. The system also supports providing WSDL documents to Universal Description, Discovery, and Integration (UDDI) repositories.

# 5) What are the benefits of Integration Gateway?

A) The integration gateway is a platform that manages the receipt and delivery of messages passed among systems through PeopleSoft Integration Broker. It supports the leading TCP/IP application protocols used in the marketplace today and provides extensible interfaces to develop new connectors for communication with legacy, enterprise resource planning, and internet-based systems.

Additional features include:

Backward compatibility for Extensible Markup Language (XML) links and PeopleSoft Application Messaging.

Listening connectors and target connectors that transport messages between integration participants and the integration engine.

Basic logging information concerning message receipt, delivery, and errors.

Connection persistence with continuous open feeds to external systems through connectors, with full failover capabilities.

Transport protocol and message format management so that when messages reach the integration engine, they have a PeopleSoft-compatible message format.

# 6) What are the benefits of Integration Engine?

A) The integration engine runs on the PeopleSoft application server. Rather than communicating directly with other applications, the integration engine sends and receives messages through one or more separately installed integration gateways.

The integration engine:

Uses a modular architecture, so it can treat gateways as black boxes and communicate with them using standard connectors.

Adapts elements of an existing integration to produce a new integration with only minor adjustments.

Handles messages containing data in a variety of formats. Formats include the PeopleSoft rowset-based message format, and nonrowset-based message structures including, XML document object model messages, Simple Object Access Protocol (SOAP) messages, and non-XML files.

Sends and receives messages asynchronously (like email) or synchronously (suspending activity to wait for a response).

Applies message transmission type and routing based on specifications that you define in a PeopleSoft Pure Internet Architecture component.

By developing and applying application engine transform programs, the application engine can transform message structure and translate data content according to specifications that you define in PeopleSoft Pure Internet Architecture components.

You develop transform application engine programs in PeopleCode or Extensible Stylesheet Language Transformation (XSLT) code.

These specifications can be reused for other integrations.

Handles security features such as authentication, nonrepudiation, and cookies.

 

7) What are the components of Integration Gateway Architecture?

A) The key components in integration gateway architecture are,

Architecture components.

  • Connectors.
  • Gateway manager.
  • Gateway services.

8) What are the components of Integration Engine Architecture?

A) The integration engine uses a variety of PeopleTools elements to create, implement, manage, and enhance integrations. Its modular architecture separates integration development activities from administrative activities.

The integration engine is a combination of PeopleSoft Application Designer definitions, PeopleSoft Pure Internet Architecture definitions, PeopleCode, and XSLT code, along with the underlying mechanisms that tie all these elements together.

The underlying mechanisms include the request handlers that process both inbound and outbound messages according to the specifications in the development and administrative elements.

The integration engine resides on the PeopleSoft application server.

 

9) What are service operations in PeopleSoft Integration Broker?

A) A service operation in the PeopleSoft system contains the processing logic for integration and determines if the integration is to be processed synchronously or asynchronously. A service operation definition contains the following definitions:

Message. A message contains the payload of the integration.

XML message schema. Message schemas provide the physical description of the data that is being sent, including descriptions of fields, field types, field lengths, and so on.

Handler. A service operation handler contains the processing logic for the service operation.

Routing. A routing definition specifies the direction of the integration (inbound or outbound), routing alias names, transformations, and more.

10) What are the different Service Operation Types?

A) PeopleSoft Integration Broker supports four types of service operations:

  1. Asynchronous one-way.
  2. Asynchronous request/response.
  3. Asynchronous to synchronous.
  4. Synchronous

11) What are the different Messaging Types in PeopleSoft Integration Broker?

A) PeopleSoft Integration Broker supports asynchronous and synchronous messaging.

12) What is Synchronous messaging?

A) In synchronous messaging, a message is sent to a target system. The sending system must receive a response from the target system before it continues to process additional messages.

13) What is Asynchronous messaging?

A) In asynchronous messaging, a message is sent to a target system. However, the sending system does not need to receive a response from the target system before it can continue processing messages. This type of messaging is also referred to as fire-and-forget messaging.

 

14) What is the Order of Precedence for Creating Integration Metadata?

A) Create integration metadata in the following order:

  • Integration gateway definition.
  • Node definition.
  • Message definition.
  • Integration PeopleCode.
  • Transformation programs.
  • Queue definition.
  • Service definition.
  • Service operation definition.
  • Handler definition.
  • Routing definition.

 15) What is PSCAMA?

A) PeopleTools adds the PSCAMA record to every level of the message structure during processing. It isn’t accessible in the message definition, but you can reference it as part of the Message object in the sending and receiving PeopleCode, and you can see it in the Integration Broker Monitor. PeopleCode processes this record the same way as any other record.

 16) What are Message Container Structures?

A) Message container structures hold rowset-based or non-rowset-based message part structures. All message parts assigned to a container must of the same type, rowset-based or non-rowset-based. A message container is always a non-rowset-based message.

 17) What is Message Schema Builder?

A) The message Schema Builder enables you to build, import, modify and delete XML message schemas.

18) What are services?

A) Services are used to logically group a set of service operations.

For example, if you have a number of service operations that are related to customers, such as those pertaining to customer information, adding customers, updating customers, deleting customers, and so on, you can create a customer web service and then associate the related service operations with that service.

19) What are Service Operations?

A) A service operation definition consists of general information about an operation, such as its name, description, and so on. It also specifies an operation type, which determines how the operation is to be processed, synchronously or asynchronously.

20) What are REST Services?

A) REST services are used to logically group a set of REST service operations.

PeopleSoft Application Engine Interview Questions and Answers

1) What is PeopleSoft Application Engine?

A) PeopleSoft Application Engine is a PeopleTool designed to help us in develop, test, and run background SQL processing programs.

2) What are the components of PeopleSoft Application Engine?

A) PeopleSoft Application Engine comprises two distinct components, they are designer and runtime.

A designer where we can define our batch program and the runtime where you run and monitor your program.

3) What is a program in PeopleSoft Application Engine?

A) In PeopleSoft Application Engine, a program is a set of SQL statements, PeopleCode, and program control actions (that enable looping and conditional logic) defined in PeopleSoft Application Designer that performs a business process.

4) Does PeopleSoft Application Engine generate SQL or PeopleCode?

A) PeopleSoft Application Engine does not generate SQL or PeopleCode, it executes the SQL and PeopleCode that you include in an Application Engine action as part of your overall program.

5) What is Batch Processing in PeopleSoft Application Engine?

A) PeopleSoft Application Engine is designed for batch processing where you have a large (or small) amount of data that must be processed without user intervention

6) PeopleSoft Application Engine Interview Questions # 6) What is PeopleSoft meta-SQL?

A) PeopleSoft meta-SQL is designed to replace RDBMS-specific SQL syntax with a standard syntax, called meta-strings.

PeopleSoft meta-SQL enables you to dynamically generate portions of your SQL statements.

7) Can you write a sample code in meta-SQL?

A) For example, if you want to join two tables on their common keys, use the following code:

%Join(COMMON_KEYS, PSAESECTDEFN ABC, PSAESTEPDEFN  XYZ)

8) What are the key Application Engine Program Elements?

A) A PeopleSoft Application Engine program is made up of several key elements:

  • Program
  • Sections
  • Steps
  • Actions
  • Do Actions
  • SQL
  • PeopleCode
  • Log Message
  • Call Section
  • State Record

9) What is a program in PeopleSoft Application Engine?

A) Program Identifiers the set of processes to execute a given task. A program must contain at least one section. The execution of the program always starts with the section defined as “MAIN.”

10) What is a section in PeopleSoft Application Engine?

A) Sections comprise one or more steps and is equivalent to a COBOL paragraph or an SQR procedure. All Application Engine programs must contain at least one section entitled “MAIN.”

A section is a set of ordered steps that gets executed as part of a program.

11) What is a step in PeopleSoft Application Engine?

A) The smallest unit of work that can be committed within a program. We can use a step to execute a PeopleCode command or log a message, typically, you use a step to execute a SQL statement or to call another section.

12) What are actions in PeopleSoft Application Engine?

A) There are multiple types of actions that you can specify to include within a step. Keep in mind that it is common to have multiple actions associated with a single step.

13) What are Do Actions in PeopleSoft Application Engine?

A)     Do actions contain a SQL SELECT statement designed to return results on which subsequent actions depend? For instance, if a SELECT returns no rows, subsequent actions may not need to execute.

14) What are the types of Do Actions in Peoplesoft Application Engine?

A) A Do action is equivalent to a COBOL PERFORM statement and has similar constructs.

The four types of Do actions are:

  • Do While
  • Do When
  • Do Select
  • Do Until

15) What is a Log Message in Peoplesoft Application Engine?

A) A Log Message action can be used to write a message to the MESSAGE_LOG based on a particular condition in your program. This gives your program multi-language capability.

The system stores the message generically as a message set, message number, and parameter values. When the end user views the messages using the Application Engine Messages panel, PeopleTools retrieves the appropriate message string from the Message Catalog based on the user’s language preference.

16) What is a State Record?

A) A PeopleSoft record that must be created and maintained by the Application Engine developer. This record defines the fields a program uses to pass values from one action to another.

17) What are the various types of Application Engine programs?

A) There are five types of Application Engine programs, they are,

  1. Standard, which is a normal entry-point program.
  2. Upgrade Only, which is used in PeopleSoft Upgrade utilities.
  3. Import Only, which is used by PeopleSoft Import utilities.
  4. Daemon Only, a special type of program used as a daemon.
  5. Transform only, another special program type used to support XSLT.

18) What is PSDAEMON?

A) PeopleSoft Application Engine has a new daemon process, called PSDAEMON that runs continuously when the Process Scheduler is running, and is intended for recurrent jobs.

19) What is a Transform Program Type?

A) These type of programs enable different systems to communicate with one another by transforming messages into appropriate formats.

20) What is definition view?

A) Definition view is where you create your definitions within a defined hierarchical structure. Within the metaphor of the definition view, nodes represent the definitions. A node is the visual representation of a section, step, or action that you can select, collapse, modify, and so on.

21) What is a Program Flow View?

A) The Program Flow view is a read-only view that shows the expected sequence of steps to be executed at runtime for the program you are developing.

22) What are the actions available within a step in application engine program?

A) The following types of actions are available for an Application Engine program:

  • SQL
  • Do (When, While, Select, Until)
  • PeopleCode
  • Call Section
  • Log Message
  • XSLT (enabled for Transform Only program types)

23) What does DO When action?

A) The Do When action is a SELECT statement that allows subsequent actions to be executed if any rows of data are returned.

24) What does Do While?

A) The Do While action is a SELECT statement that, if present, runs before subsequent actions of the step. If the Do While does not return any rows of data, the action terminates.

25) What does Do Select?

A) The Do Select action is a SELECT statement that executes subsequent actions once for every row of data that the Do Select returns. For instance, a Do Select can execute a SQL statement for each row returned from the SELECT statement.

26) What does Do Until?

A) 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.

27) What are PeopleCode Actions?

A) Use this action type to insert PeopleCode within your Application Engine program. You can invoke the PeopleCode Editor directly from the designer interface to code your PeopleCode programs.

28) What is Call Section Actions?

A) Use the Call Section action to call another section defined in an Application Engine program. You can call a (local) section defined within your current program and you can make external calls to a section defined in another Application Engine program.

29) What are State Records?

A) We can assign variables for your Application Engine program through state records, while sections, steps, and actions pass values to subsequent program steps through state records.

30) What is Set Processing?

A) Set processing is an SQL technique used to process groups, or 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.

Advanced PeopleSoft Application Engine Interview Questions

31) What is a %Bind?

A) Retrieves a field value from a state record and can be used anywhere in a SQL statement. When executed, %Bind returns the value of the state record field identified within its parentheses.

%BIND([recordname.]fieldname[,NOQUOTES][,NOWRAP][,STATIC])

32) What is %ExecuteEdits?

A) Enables PeopleSoft Application Engine to support data dictionary edits in batch. It is Application Engine-only meta-SQL, you cannot use it in COBOL, SQR, or PeopleCode—not even Application Engine PeopleCode.

%ExecuteEdits(<type>, recordname [alias][, field1, field2, …])

33) What is %Select?

A) This function is required at the beginning of any and all SELECT statements. For example, you need one in the flow control actions and one in the SQL actions that contain a SELECT.

The %SELECT function identifies the state record fields to hold the values returned by the corresponding SELECT statement. In other words, you use %SELECT to pass values to the state record buffers.

34) What is %SelectInit?

A) This meta-SQL construct is identical to %SELECT with the following exception if the SELECT returns no rows, %SelectInit reinitializes the buffers. In the case of a %SELECT and no rows are returned, the state record fields retain their previous values.

35) What is %SQL?

A) When you use %SQL in a statement, PeopleSoft Application Engine replaces it with the specified SQL object. This enables commonly used SQL text to be shared among Application Engine and PeopleCode programs alike. In PeopleSoft Application Engine, you use %BIND to specify your bind variables.

In PeopleCode SQL, you can use

:record.field
or
:1

36) What is %Table?

A) This function returns the SQL table name for the record specified with recname. The basic syntax is:

%Table(recname)

For example,

%Table(ABSENCE_HIST)

Returns the record PS_ABSENCE_HIST.

37) What is %TruncateTable?

A) This construct is functionally identical to a DELETE SQL statement with no WHERE clause, but it is faster on databases that support bulk deletes.

38) What is %UpdateStats?

A) PeopleSoft Application Engine replaces this meta-SQL construct with a platform-dependent SQL statement that updates the system catalog tables used by the database optimizer in choosing optimal query plans.

39) What is AESection Object?

A) The AESectionPeopleCode object enables you to change the properties of an Application Engine program Section dynamically without having to modify any of the Application Engine tables directly. This enables you to develop “rule-based” applications that conform dynamically to variables that an end user submits through a page, such as the Application Engine Request page.

40) What is File Layout Object?

A) The file layout object enables you to perform file input/output operations with PeopleSoft Application Engine using PeopleCode. With the File object, you can open a file (for reading or writing), read data from a file, or write data to it. Using the combination of the File Object and PeopleSoft Application Engine provides an effective method to integrate (or exchange) the data stored in a legacy system with your PeopleSoft system.

41) What is CommitWork function?

A) This function commits pending changes (inserts, updates, and deletes) to the database.

42) What is Parallel Processing?

A) Parallel processing is used when considerable amounts of data must be updated or processed within a limited amount of time, or “batch window.” In most cases, parallel processing is more efficient in environments containing multiple CPU’s and partitioned data.

45) Can we’ve App Engine without a state record?

Ans: Yes, you can have an App Engine (AE) without a state record. However, you can’t use do actions.

46) How many state records we can use for an application engine Program?

Ans: An Application Engine can have up to 200 state records, but only one can be the default state record.  State records are used to track information throughout the life of a program.

47) What is the Application Engine Action Plugins do?

·        Application Engine Action Plugins are a PeopleTools feature that can change SQL or PeopleCode actions in any App Engine program  without affecting/customizing the delivered one.

·        An Application Engine On-exit plugin is a new PeopleTools feature that allows you to invoke an SQL or PeopleCode action at the end of any App Engine program. This was released in PeopleTools 8.59

 

 

 

 

 

 

PeopleCode to retrieve Google map between two addresses

  PeopleCode Example: /* Define constants for the API request */ Local string &origin = "123 Main St, Anytown, USA";   /* ...