Saturday, 30 June 2018

List of some useful OOTB Pega PRPC functions

Here I will provide the list of some useful functions based on the data types.

Date/DateTime functions:-

addTime(DateTime,calender) from PegaRULES:DateTime library
 
Add an amount of business or calendar time to a DateTime



CurrentDateTime() from PegaRULES:DateTime library

Return the system current DateTime in following format: 20181026T051021.606 GMT


differenceBetweenDate(DateTIme1, DateTIme2, usebusinessdays, Calendarname ) from Pega-RULES:BusinessCalendar library


Calculates the integer number of calendar or business days between a first and a second DateTime value, optionally based on a calendar data instance. This is positive if the first date is later than the second date. A day is defined as 60*60*24 seconds in this calculation.



FormatDateTime(DateTime, format,*,*) from Pega-RULES:DateTime library


For example FormatDateTime(DateTime,"yyyy-MM-dd'T'HH:mm:ss",null,null)



isBusinessDay(date,calendar) from Pega-RULES:BusinessDate library


True if the date is a business day in the calendar identified by the second parameter.


Property Functions:-

IsInPageList(LookFor, LookAt, LookIn) from Pega-RULES:Utilities library 
Searches through the values in a Page List property for a match.  


IsInPropertyList(LookFor, LookIn) from Pega-RULES:Utilities library

Search through the values in a Value List property for a match.

PageExists(pagename, activityname) from  Pega-RULES:Default library

Check whether a page of a specific name already exists, in the context of an activity.

Data Elements in Pega

Pega PRPC handles data through different data elements. As part of our implementation, we create a data model to represent and store different information. The fundamental unit of data model in pega is called "Property". 

There are different property modes in pega for our convenience. For example if we want to store a single piece of information like Name then we use Single Value Property and for a collection of information like Address we use Page. Here is the list of property modes:-

Single Value:- Use to store a single Text , number or Date e.g. "Pega",1234.

Value List:- Use to store ordered list of values e.g. For job history of employee we can use value list to store Job(1)='App Dev', Job(2)='Pega Dev' etc.

Value Group:- Use to store unordered list(like key value pair). e.g. Phone(Home)='1234', Phone(Office)='2345' .

Page :- To store multiple embedded properties e.g. Address Page with properties HouseNo, PinCode, City etc.

PageList:- To store ordered list of pages  e.g. Address(1), Address(2). 

PageGroup:- To store unordered list of pages e.g. Address(Home), Address(Office).

There are also some advanced property type like Java Objects(String,Integer, Class Object) or List of Java Objects.



Create a new application in Pega

Normally in programming languages it takes a lot of time to create a new applications from scratch but in pega we have a wizard to create a new application. So in few clicks we can create a brand new pega application skeleton.
Steps:-
After logging in open the new application wizard in web based pega IDE. Click PegaRULES icon from top toolbar and select "New Application".







There are the following details you have to provide as part of this wizard:-

Basic Information:- Application Name, Description, Org etc.

Business Objectives:- what this application will be used for..

Define Cases:- Here you can provide multiple cases

Define Data:- Provide the data information which will be used to interact with the application

Here you can select  either Implementation only or Framework only or both based on your requirement.
Implementation Only:- Application will created on the top of PegaRULES or the Framework you select.

Framework Only:- It will a create a framework application which can be used to build other application on the top of it.






 
And after providing all the details for each screen you can submit and an application will be created.