Functions in Pega
In Pega, functions in pega are reusable logic blocks that can be used to perform specific operations within rules. Functions in pega can be categorized into several types based on their purposes and usage within the Pega platform.
1. Standard Library Functions:
Pega offers a standard library of functions for common operations such as string manipulation, date and time calculations, and mathematical operations. These functions are usable across various rules and activities within Pega.
2.Custom Functions:
Developers can create custom functions to encapsulate specific logic that is reusable across multiple rules. These functions are written in Java and can be included in RuleSets for versioning and deployment.
3.Expression Builder Functions:
The Expression Builder in Pega enables you to create complex expressions using built-in functions. Furthermore, these functions are applicable within expressions in decision tables, decision trees, data transforms, and other types of rules.
4.Activity Functions:
Activities in Pega incorporate functions that perform specific tasks, including data retrieval, manipulation, and integration with external systems. These functions are defined as steps within an activity.
5.Data Transformation Functions:
Data transforms in Pega are used to map, transform, and copy data between different structures. Functions within data transforms can perform operations such as setting values and appending to lists, while utilizing conditional logic.
6.Decision Tables and Decision Tree Functions:
Decision tables and decision trees use functions to evaluate conditions and subsequently return results based on input data. Moreover, these functions can perform comparisons, calculations, and other logic to effectively drive decision-making.
7.Report Definition Functions:
Report definitions in Pega use functions to filter, sort, and manipulate data retrieved from the database. Therefore, these functions play a crucial role in generating reports based on specific criteria and formatting requirements.
8.When Rules:
When rules in Pega define conditions that evaluate expressions to return true or false. Functions within when rules assist in establishing complex conditional logic.
9.Declare Expression Functions:
Declare expressions in Pega define computed properties. Functions within declare expressions subsequently perform calculations or transformations to derive values for these properties.
10.Correspondence Rules:
Correspondence rules in Pega use functions to format and generate correspondence such as emails, letters, and SMS messages. These functions effectively facilitate dynamic content generation and formatting.
Keyword Functions in Pega
Keyword functions in pega are specific functions that can be used within expressions, decision rules, however, other contexts to perform predefined operations. Here are some commonly used keyword functions in Pega.
Expression Builder can be used from
- Activity
- DTF
- When rules
- Validations
- Report rules, etc.
Some of the functions and their uses.
pyRemoveDuplicatesFromPagelist: This function can be used to initially find duplicate pages in a page list and subsequently remove them.
- findInList: Finds a specific page out of a list with reference to a property value.
- pxFindInPageListContains: Looks for a partial match of a string in the page list. The return is a list.
- IndexinPageList: Returns the index of the matching page by property value.
- CountInPagelist: Returns the number of occurrences in the page list of a given property value.
- LengthOfPageList: Returns the number of pages in the page list.
- CurrentDate: Returns the current date only in the requested format such as IST, EST, etc.
- getCurrentDateStamp: Retrieves the current date in PEGA format.
- isDateInPast: Requires passing one date property value. This function returns true if the data is past; otherwise, it returns false.
String Function:
Equals (Str, Str2) checks the equality of two strings and returns a boolean.
Pash, pash -> Not Equal
Equalsignorecase(Str1,Str2): Firstly, this function checks the equality of two strings and then returns a Boolean value, importantly ignoring case sensitivity.
Pash, pash: Both are equal.
Conclusion
These keyword functions in Pega add in constructing expressions however, logic within Pega rules, offering a powerful method to execute various operations without requiring custom coding.