Peoplecode Flashcards
Learin Peoplecode concepts
Different Data Types
Conventions data types & Object data type
Conventional Data types
Any - If type is not defined, then by default it is any. Peopletools determines the type of ‘ANY’ variable based on context at runtime.
Boolean Date DateTime Float Integer Number Object String Time
Integer
32-bit signed twos complement number, so it has a range of -2,147,483,648 to 2,147,483,647
Float
number represented using the machine floating binary point (double precision) representation.
This type is not suitable for calculation involving decimal fractions, particularty for money transactins.
For ex: .10 + .10 will not be .20 for this type.
Number
Size limit of 34 digits not including decimal point. 32 digits to the right of decimal point.
Since the Number type is a floating decimal point representation, it is the appropriate data type for calculations involving money.
Operations
Operations other than Division is done using Integer arithmatic
Division is done using Floating point decimal.
Recommendation on using Integer, Float, Number
Use Number for most applicable data values
Use Integer when counting item, for ex rows in rowset.
Use Float for
Seperator Statements
It seprated one statement from another and is ;
Assignment statement
it is =, it can also be used in evaluation statement depending on context
Branching statement
If, then, else
Evaluate
Looping statement
For, Repeat, While
Language constructs
PeopleCode language constructs include:
Branching structures: If and Evaluate.
Loops and conditional loops: For, Repeat, and While.
Break, Continue, and Exit statements loop control and terminating programs.
The Return statement for returning from functions.
Variable and function declaration statements: Global, Local, and Component for variables, and Declare Function for functions.
The Function statement for defining functions.
Class definition statements.
Try, Catch, and Throw statements for error handling.
example of a function declaration of a function that is in another FUNCLIB record definition
Declare Function UpdatePSLOCK PeopleCode FUNCLIB_NODES.MSGNODENAME FieldFormula;
Function parameter values tip
check the values of parameters that get passed to functions at runtime in the Parameter window of the PeopleCode debugger.
Function Naming Conflicts
If you define a function with the same name as a built-in function, the function that you defined takes precedence over the built-in function