Hi This is very basic question , To understand the When Rule best practices ,
Note: I am using below mention When rule in CDH project where to check eligibility crietria which means this when rule can be executed against few million cutomers data hence trying to understand a best practice .
Example of when condition .
business Requriement :
Users are eligible if balance amount is greater than 0 but less than 2000000
B - ( maturity date > current date && maturity date < current date + 15 )
Logic : ( A AND B )
Please suggest which is the best option for performance . certainly Option 1 is good for Business user as its more readable but at the same time I am trying to understand is there any considerable performance improvement if I go with Option2.
Or please suggest any better option whcih can improve perfromance considerably .
@ChetanD5675 Hi , instead of current date + 15, if we do addtodatetime and set it in a param or property, that will improve the performance and I believe both option A and B have the same performance.
Use functions as much as possible eg: instead of current date + 15 use @addCalender() etc.
Avoid hardcoding values eg: instead of hardcoding 2000000, refer it from parameter/decision table/DSS etc. so that its easier for the user to configure.
Granularizing when rules steps is always a better option, then Pega needs to process less for each field.
· isBalanceInRange(balanceAmount): This function the balance amount is within the specified range.
· isMaturityDateWithinNextDays(maturityDate, days**)**: This checks if the maturity date is within the next specified number of days from the current date.