21. Naming Conventions
Record Type Names
● bumpy case with initial uppercase,
● - E.g. Person or EmployeeDetails
Attribute names in records
● - bumpy case with initial lowercase
● - E.g. name or firstName
24. Creating a Person Record
var p : Person;
var a : Address;
a.line1 = "12 Hight St";
a.zip = "PA 12345";
p.name = "Simon";
p.tel = "1234567";
append(p.addresses, a);
26. String Concatenation
var s1 = "The Start"
var s2 = "The Middle"
var s3 = "The End"
var result = s1 + ", " + s2 + ", " +
s3 + ". " + 3 + " parts.";
The Start, The Middle, The End. 3 parts.
29. Collections
var people : Person[];
var names : String[];
append(names, "Fred");
append(names, "Jane");
30. INSERT
var people : Person[];
var names : String[];
append(names, "Fred");
append(names, "Jane");
insert(names, "Joe", 0);
31. Collections and []
var people : Person[];
var fred : Person[];
fred.name = "Fred";
fred.tel = "12345";
people.append(fred);
var jane : Person[];
jane.name = "Fred";
jane.tel = "12345";
people.append(jane);
32. Removing from a Collection
var people : Person[];
var fred : Person[];
fred.name = "Fred";
fred.tel = "12345";
people.append(fred);
remove(people, fred);
notify(people[1].name);
33. Date and Time Types
● Date - day, month, year
● Time - hour, minute, second
● Duration - hour, minute, second
● Timestamp
34. Date and Time Arithmetic
var t : Time;
t = timeNow();
var dt : Duration;
dt.hour = 1;
t = addTime(t, dt);
36. Date Formatting
Code Description Example
Result
d Day of the month without leading zero “1”
dd Day of the month with leading zero “01”
ddd The localised name for the day of the week “Sunday”
m Month of the year without leading zero “1”
mm Month of the year with leading zero “01”
mmm The localised short (3 letter) name for the month “Jan”
mmmm The localised full name for the month “January”
yy The year as two digits “10”
yyyy The year as four digits “2010”
var today : Date;
today = dateNow();
formatDate(today, “mmm d, yyyy”);
“January 1, 2011”
37. Time Formatting
Code Description Example result
HHH Hour in 24 hour format with leading zero 19
HH Hour in 24 hour format with leading zero 08
H Hour in 12 hour format without leading zeros 8
MM Minute with leading zero 05
M Minute without leading zero 5
SS Seconds with leading zero 09
S Seconds without leading zero 9
PP am / pm indicator am
var t : Time;
t = timeNow();
formatTime(t, “HH:MM:SS PP”);
“12:34:10 am”