0% found this document useful (0 votes)
24 views2 pages

PeopleCode CheatSheet

Uploaded by

muhammad.ammad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views2 pages

PeopleCode CheatSheet

Uploaded by

muhammad.ammad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PeopleCode Cheat Sheet

Basic Structure
Comments:
-- Single line comment
/* Multi-line comment */
Variables:
Local string &name;
Local number &count;
Local date &today;
Local boolean &flag;
Assignment:
&name; = "John";
&count; = 5;

Control Structures
If statement:
If &count; > 0 Then
/* code */
Else
/* code */
End-If;
While loop:
While &count; < 10
&count; = &count; + 1;
End-While;
For loop:
For &i; = 1 To 10
/* code */
End-For;
Evaluate (switch):
Evaluate &grade;
When = "A"
/* code */
When-Other
/* code */
End-Evaluate;

Functions and Procedures


Function declaration:
Function AddNumbers(&a; As number, &b; As number) Returns number
Return &a; + &b;
End-Function;
Calling function:
Local number ∑ = AddNumbers(5, 10);
Built-in functions:
Upper(&string;), Lower(&string;)
Substring(&string;, start, length)
Length(&string;)
DatePart("YYYY", %Date)

Objects
Record example:
Local Record &rec; = CreateRecord(Record.PERSONAL_DATA);
&[Link]; = "123";
&[Link];();
Rowset example:
Local Rowset &rs; = GetLevel0()(1).GetRowset(Scroll.EMPL_DATA);
Local Row &row; = &rs;(1);
&[Link];_DATA.[Link] = "John Doe";
Miscellaneous
MessageBox example:
MessageBox(0, "Title", 0, 0, "Hello World!");
SQL example:
Local SQL &sql; = CreateSQL("SELECT NAME FROM PS_PERSONAL_DATA WHERE EMPLID = :1",
&emplid;);
While &[Link];(&name;)
MessageBox(0, "", 0, 0, &name;);
End-While;
DoSelect loop:
SQLExec("SELECT COUNT(*) FROM PS_PERSONAL_DATA", &count;);

You might also like