2. MEMORY VARIABLES
firstName = “Tom” create a cchracter memory
variable whose symbolic name shall be firstName
and assign to the string “Tom” to that variable
lastName= “Jerry” create a cchracter memory
variable whose symbolic name shall be lastName
and assign to the string “Jerry” to that variable
Display memory display local variables, foxpro
system variable, windows definition, menu
definition and pop-up windows definition
4. MEMORY VARIABLES (3)
noName = firstName create a carachter memory variable whose symbolic name
shall be noName and assign the contents to the contents of variable firstName
Key = 5 creates a numeric memory variable whose symbolic name shall be Key and
assign 5 to that variable
Key = 5.5 creates a numeric memory variable whose symbolic name shall be Key
and assign 5.5 to that variable
Valid = .T. create a logical memory varible whose symbolic name shall be Valid and
assigns True to that variable
Valid = NOT .F. create a logical memory varible whose symbolic name shall be Valid
and assigns True to that variable
myDay = {12/25/98} creates a logical memory variable whose symbolic name shall
be myDay and assigns 12/25/98 to that variable
5. STRING FUNCTION AND
MANIPULATION
firstName = “tom”
lastName = “jerry”
noName = “john doe”
The + symbol is used to concatenate
(merge/combine) two or more strings
?”Hello” + firstName display Hello tom
? firstName + lastName display tomjerry
? firstName +’ ’+ lastName display tom jerry
6. STRING FUNCTION AND
MANIPULATION (2)
UPPER FUNCTION
? ‘*‘ + Upper(firstName) + ‘+’ display [TOM]
? ‘*‘ + Upper(“good TimE”) + ‘+’ display [GOOD TIME]
totalName = firstName +’ ’+lastName create a local
memory variable whose symbolic name shall be totalName
and assigns the contents to tom jerry
totalName = Upper(lastName)+’, ’+Upper(firstName )
create a local memory variable whose symbolic name shall be
totalName and assigns the contents to JERRY, TOM
7. STRING FUNCTION AND
MANIPULATION (3)
LOWER FUNCTION
firstName = “TOm”
lastName = “JERry”
noName = “john doe”
? ‘*‘ + Lower(firstName) + ‘+’ display [tom]
? ‘*‘ + Lower(“good TimE”) + ‘+’ display [good time]
totalName = firstName +’ ’+lastName create a local memory variable
whose symbolic name shall be totalName and assigns the contents to tom
jerry
totalName = Upper(lastName)+’, ’+Upper(firstName ) create a local
memory variable whose symbolic name shall be totalName and assigns the
contents to JERRY, TOM
8. Operasi Tanggal dan Waktu
CDOW() : menghasilkan nama hari dalam bahasa inggris
Logic : ?CDOW(ctod(“tanggal”))
Contoh : ?CDOW(ctod(“3/20/2006”)) Monday
CMONTH() : menghasilkan nama bulan dalam bahasa inggris
Logic : ?CMONTH(ctod(“tanggal”))
Contoh : ?CMONTH(ctod(“3/20/2006”)) March
DATE() : menghasilkan nilai tanggal sekarang
Logic : ?DATE()
Contoh : ?DATE() 04/09/2013
9. Operasi Tanggal dan Waktu(2)
DATETIME() : menghasilkan nilai tanggal sekarang
Logic : ?DATETIME()
Contoh : ?DATETIME() 04/09/2013 05:30:21 PM
DAY() : menghasilkan tanggal (1 sd 30)
Logic : ?DAY(“tanggal”)
Contoh : ?DAY(ctod(“3/20/2006”)) 20
DMY() : menghasilkan tanggal, bulan ,dan tahun
Logic : ?DMY(ctod(“tanggal”))
Contoh : ?DMY(ctod(“3/20/2006”)) 20 March 2006
10. Operasi Tanggal dan Waktu(3)
MDY() : menghasilkan bulan, tanggal, dan tahun
Logic : ?DMY(ctod(“tanggal”))
Contoh : ?DMY(ctod(“3/20/2006”)) March
20, 2006
TIME() : menghasilkan jam sekarang dengan format
hh:mm:ss
Logic : ?TIME()
Contoh : ?TIME() 05:30:21
11. Operasi Numeric
ABS : menghasilkan nilai mutlak
Contoh : ?ABS(-3) 3
INT() : menghasilkan bilangan bulat
Contoh : ?INT(1.9) 1
12. Konversi Tipe dan Ekspresi
ASC() : menghasilkan nilai ASCII dari karakter yang menjadi
argumen
Contoh : ?ASC(“A”) 65
CHR() : menghasilkan sebuah karakter yang nilai ASCII nya
dicantumkan dalam argumen
Contoh: ?CHR(65) A
CTOD() : menghasilkan data bertipe tanggal berdasarkan
string argumennya
Contoh: ?CTOD(“3/20/2006”) 03/20/2006 Contoh
13. Konversi Tipe dan Ekspresi (2)
DTOC() : menghasilkan data bertipe string
berdasarkan date argumennya
Contoh: ?DTOC(date()) “03/20/2006”
STR() : menghasilkan nilai string dari numeric
Contoh: ?STR(5) “5”
VAL() : menghasilkan nilai numeric dari string
Contoh : ?VAL(“5“) 5