0% found this document useful (0 votes)
52 views9 pages

FoxPro Command Reference Guide

Uploaded by

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

FoxPro Command Reference Guide

Uploaded by

shree4u.in
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 9

FOXPRO

Clear clear screen


Create new filename new dbf file
List show list of records without any message
Display all show all records with message press any
to continue to right up side and remaining on next
Page.
Append add record.
Ctrl & W to save record and exit.
Modi stru change structure of dbf file.
Display stru display structure on screen.
Browse change record.
Delete reco 1 mark for delete record.
pack delete record.
zap all record delete.
recall reco 1 to remove delete mark.
browse cannot mark for delete record.
rename current filename to new filename to rename dbf filename.
copy file current filename.dbf to another filename.dbf
copy file to another having same structure
with no records to another file.
list for field name= number for list particular record of number field.
list for field name=”word “ for list particular record of character field.
browse for field name=number show particular record of number field
in browse window.
browse for field name=”word” show particular record of character field
in browse window.
index on field name to current file name to make record in ascending order.
use to make off the current dbf file.
use filename to make on the dbf file.
count for field name=number will show how many record in status bar
of particular record.
locate for field name=number will show position of record in status bar.
locate for filed name=”word” will show position of record in status bar.
goto reco record number will go to the record and display data.
? field name
edit record number change record from that record.
list reco record number list record from that and next two records.
list next 2
Use filename
sort on field name/d to new file name sort current file to descending order
and put them to new file.
replace total with subject+subject for fieldname=number or “name”
for single record total.
replace all total with subject+subject for all record total.

SANDIP SHINGTE. 1
replace avg with total/no of subject for field name=number or “name”
single record average.
replace all avg with total/no of subject all record average.
store date() to current
?day(current) will show current date.
?year(current) will show current year.
?month(current) will show current month.
?cmonth(current) will show current month in character.
?cdow(current) will show current day in character.
Sum fieldname will show total of fieldname.
calculate min(field name) will show minimum value of field.
erase filename.dbf will erase dbf file.
erase filename.prg will erase program file.
Ch =”name”
?len (ch) will show the length of word or character.
set talk off will not message in status bar.
set confirm on will go to record after enter only.
set heading off will not show field name.
set bell off will not hear sound in append.
set safety off will not show overwrite message while ind.
browse for field name = number or “name” or field name=number or “name”
will show anyone record.
browse for field name=number or “name” and field name=number or “name”
will show both record.
store date() to current
?current + 5 will add 5 to current date.
?pv(deposit amt, rate/no of month , no of days) will show present value.
?fv(deposit amt, rate/no of month ,no of days) will show future value.
store 0 to marks
?sign(marks) will show 0.
?sign(20) will show 1.
?sign(-20) will show –1.
?ceiling(189.90) will show above number 190.
num=12.56
?int(num) will show only integer)
?float(num) will show number with decimal.
?2000% 5 will show remainder.
?log(100) will show log of value.
close database will close the dbf file.
quit come out of foxpro.

SANDIP SHINGTE. 2
MODI COMM BOX
clear
@1,3 to 30,90 double
@2,5 to 10,15
@2,17 to 10,48
@2,30 to 10,42
@2,45 to 10,57
@12,5 to 20,15

MODI COMM NAMEBOX


clear
@1,3 to 30,90 panel
@2,5 to 10,25
@5,10 say "Deepak" Font "shivaji01", 12 colo "+b" style "b/t"

MODI COMM LINE


clear
@2,10 to 30,10
@5,10 to 5,50

MODI COMM MAJOR


clear
accept "name:"to n
input "age:" to a
if a>18
?"major"
else
?"minor"
endif

MODI COMM LEAP


clear
input "enter the year:" to y
if y%4==0
?"Leap Year"
else
? "Not a leap year"
endif
MODI COMM ODD
clear
for i=0 to 15 step 2
?i
endfor
MODI COMM DATE

SANDIP SHINGTE. 3
clear
dt={"____/____/"}
@5,5 say"date is"get dt
read
store mdy(dt)to dt1
@5,5 say"date is"get dt1
read

MODI COMM PASSWORD1

clear
p=space(11)
@3,5 say "Enter password:"get p
read
if p="SANDIP"
wait window"correct password"
else
wait window"incorrect password"
endif
MODI COMM PASSWORD2

clear
p=space(11)
@3,5 say "Enter password:"get p
read
if p="SANDIP"
clear
do namebox.prg
else
wait window"incorrect password"
endif

MODI COMM CHOICE


clear
dimension choice(3)
store 'Masala Dosa' to choice(1)
store 'Veg Pizza' to choice(2)
store 'Fried Rice' to choice(3)
store 0 to mchoice
@5,0 menu choice,3 title"Menu at your table"
read menu to mchoice
do case
case mchoice=1
@10,0 say "Masala Dosa for Lunch"
case mchoice=2
@10,0 say "Veg Pizza for Lunch"

SANDIP SHINGTE. 4
case mchoice=3
@10,0 say"Fried Rice for Lunch"
endcase

CREATE JSAN

MODI COMM ADD


CLEAR
DO while.t.
@28,5 say"Press esc key to exit"
USE jsan
mname=SPACE(10)
maddr=SPACE(20)
mtel=0
ans=“Y”
@2,5 TO 20,50 DOUBLE
@4,8 say"name:"get mname pict"@!"
@6,8 say"add:"get maddr pict"@!"
@8,8 say"telno:"get mtel pict "9999999"
READ
@12,8 say"is data correct(y/n)?"get ans pict"@!"
READ
IF READKEY()=12
CLEAR
RETURN
ENDIF
IF ans=“Y”
USE jsan
APPEND BLANK

SANDIP SHINGTE. 5
REPLACE name WITH mname
REPLACE add WITH maddr
REPLACE telno WITH mtel
ELSE
LOOP
ENDIF

@12,8 say"do you want to continue(y/n)"get ans pict"@!"


READ
IF ans=“Y”
@12,7 TO 12,48 CLEAR
LOOP
ELSE
RETURN
ENDIF
ENDDO

MODI COMM UPDATE

CLEAR
DO while.t.
USE jsan
DEFINE WINDOW abc FROM 5,1 TO 17,80
@ 2,5 say"Press Esc key to select record"
BROWSE FIELDS name,add,telno NOMODIFY WINDOW abc
DO pro
ans=“Y”
@26,15 say"update more records(y/n)"get ans pict"@!"
READ
IF ans=“Y”
LOOP
ELSE
CLEAR
RETURN
ENDIF
ENDDO
*****
PROCEDURE pro
CLEAR
DO WHILE .T.
mname=name
maddr=add
mtel=telno
@7,20 TO 20,60 DOUBLE
@9,22 say"name:"get mname

SANDIP SHINGTE. 6
@11,22 say"add:"get maddr
@13,22 say"telno:"get mtel
READ
ans=“Y”
@24,15 SAY "is data ok(y/n)"GET ans pict"@!"
READ
IF ans=“Y”
REPLACE name WITH mname
REPLACE add WITH maddr
REPLACE telno WITH mtel
ELSE
LOOP
ENDIF
RETURN
ENDDO

MODI COMM SEARCH


CLEAR
USE jsan
nm=SPACE(10)
nb=0
DO WHILE .T.
@5,5 prompt"namewise"
@7,5 prompt"numberwise"
@10,5 prompt"exit"
MENU TO ch
DO CASE
CASE ch=1
CLEAR
@15,5 SAY "Enter name to search"GET nm
READ
LOCATE FOR name=nm
IF FOUND()
DISPLAY
WAIT WIND
ELSE
WAIT WIND"no records found"
ENDIF
nm=SPACE(10)
nb=0
CASE ch=2
CLEAR
@15,5 say"Enter telno TO search"get nb pict"9999999"

SANDIP SHINGTE. 7
READ
LOCATE FOR telno=nb
IF FOUND()
DISPLAY
WAIT WIND
ELSE
WAIT WIND "no records found"
ENDIF
CLEAR
CASE ch=3
CLEAR
EXIT
ENDCASE
ENDDO

MODI COMM DELETE


CLEAR
DO while.t.
USE jsan
DEFINE WINDOW abc FROM 5,1 TO 17,80
@2,5 say"Press esc to select record"
BROWSE FIELDS name,add,telno NOMODIFY
DO pro
ans=“Y”
@26,5 say"delete more records(y/n)" get ans pict"@!"
READ
IF ans=“Y”
LOOP
ELSE
CLEAR
RETURN
ENDIF
ENDDO
***
PROCEDURE pro
@5,5 say"name:"+name
@7,5 say"add:"+add
@9,5 say"tel:" +str(telno)
ans=“Y”
@25,25 say"are you sure(y/n)" get ans pict"@!"
READ
IF ans =“Y”
DELETE
PACK
ELSE

SANDIP SHINGTE. 8
RETURN
ENDIF

MODI COMM POP


clear
use jsan
define popup database from 5,25 to 16,50 title "Shree Ganeshay Namaha.";
footer"Press esc to exit"
define bar 1 of database prompt "\<list all records"key alt+l
define bar 2 of database prompt "\<browse records"
define bar 3 of database prompt "\<edit records"
define bar 4 of database prompt "\<append records"
define bar 5 of database prompt "\<close"
on selection bar 1 of database display all
on selection bar 2 of database browse noedit
on selection bar 3 of database edit
on selection bar 4 of database append
on selection bar 5 of database deactivate popup database
activate popup database

MODI COMM MENU


CLEAR
USE jsan
DEFINE MENU pp
DEFINE PAD LIST OF pp PROMPT "list"
DEFINE PAD STRUC OF pp PROMPT "display stru"
DEFINE PAD APPEND OF pp PROMPT "append"
DEFINE PAD CLOSE OF pp PROMPT "close"
ON SELECTION PAD LIST OF pp LIST
ON SELECTION PAD STRUC OF pp DISPLAY STRU
ON SELECTION PAD APPEND OF pp APPEND
ON SELECTION PAD CLOSE OF pp DEACTIVATE MENU pp
ACTIVATE MENU pp

Figure i

SANDIP SHINGTE. 9

You might also like