Competency-Based Learning Material
Competency-Based Learning Material
TABLE OF CONTENTS
Learning Experiences
INFORMATION SHEET # 1
HISTORY OF FOXPRO
The final published release of FoxPro was 2.6, after which the name was changed to Visual FoxPro.
Although no longer sold or supported by Microsoft, there is still an active worldwide community of
FoxPro users and programmers. FoxPro 2.6 for UNIX (FPU26) has even been successfully installed
on Linux and FreeBSD using the Intel Binary Compatibility Standard (ibcs2) support library.
Version information
Extant Versions by OS
Version FP 2.0 FP 2.5 FP 2.6
MS-DOS Yes Yes Yes
Windows 3.1 to XP Yes Yes Yes
Macintosh Yes Yes Yes
SCO UNIX No No Yes
Linux & FreeBSD No No Yes
Windows 2000 No No Yes
TECHNICAL ASPECTS
FoxPro 2 included "Rushmore" optimizing engine, which used indices to accelerate data retrieval
and updating. Rushmore technology examined every data-related statement, and looked for filter
expressions. If one was used, it looked for an index matching the same expression.
In addition, FoxPro2 was originally built on WatCOM C++, which had its own memory extensor - at
that time state-of-the-art. FoxPro2 could access expanded and extended memory, using almost all
available RAM (DOS). It used some interrupts in absence of the extended memory driver: if no
HIMEM.SYS was loaded, FoxPro enabled that mechanism.
VERSION TIMELINE
INFORMATION SHEET #2
FOXPRO ENVIRONMENT
CONTROL BUTTONS
TITLE BAR MENU BAR
SCREEN
COMMAND WINDOW
1. Title Bar - The Title bar gives the name of the document and the program or application
being used.
2. Menu Bar - The Menu bar displays different menus such as System, File, Edit, Database,
Record, Program, Window and dropdown menus.
3. Control Buttons
The Minimize button moves the entire window to your taskbar - the bar that runs
across the bottom of your computer screen.
The Restore button is use to back the original size of the window.
The Maximize button is use to enlarge the size or appearance of the current
window.
4. Command Window – the Command window is often the fastest way to get things done.
5. Screen – this part of the environment is where you manipulate the design of your program.
OPERATION SHEET #1
Purpose: The student will learn how to open a FoxPro Application in a different
way.
Procedure
1.1) Open FoxPro application by clicking the start menu then look for the Run Icon and
select it.
Run
1.2) After selecting the Run Icon a dialog box will appear , Type the directory of FoxPro
application “C:\Foxpro\Foxpro.exe” to the Run Dialog Box.
1.3) after typing the Right directory of FoxPro, press enter or click OK to appear the FoxPro
window.
2.1) Open FoxPro applications by clicking in the start menu then select My Computer.
2.3) look for the folder of FoxPro, and then open it.
2.4) Look and open the foxpro.exe application. The FoxPro window will appear once you
open the application.
FoxPro.ex
e
application
Precaution
Make sure the directory of the Application is Correct.
Quality Criteria:
1.) Open a FoxPro Application using Run Dialog box in the menu.
2.) Open a FoxPro Application in the Local Disk (c :).
OPERATION SHEET #2
Purpose: The student will learn how to close a FoxPro Application in a different
way.
Procedure
Closing the FoxPro application
a. Using File Menu
Click File then select Quit.
INFORMATION SHEET #3
BASIC COMMANDS
@ PROMPT COMMAND
Syntax: @ <row>,<col> prompt <”Expression”>
Same with the @ say command, this will also display the expression you specified after the prompt
keyword. The only difference is it can be generated into light bar button when the menu to command
has been used.
@ BOX COMMAND
Syntax: @ <row>,<col>,<row>,<col> box
This command is use to simply display a box. The size of the box defends on the given coordinates
(the specified starting row and column and ending rows and column.)
@ DOUBLE|PANEL COMMAND
Syntax: @ <row>,<col> to <row>,<col> panel/double
This command is use to simply display a box also. The size of the box defends on the given
coordinates (the specified starting row and column and ending rows and column.) It defers in the
terms that it display either double line or a thick single line.
READ
Syntax: Read
This command lets the user edit the variables of all active @... Get commands. It is used in
programming to allow the user to enter data into a data entry screen that you design.
@...CLEAR TO COMMAND
Syntax: @ <srow>,<scol> clear to <erow>,<ecol>
Sample: @ 4,2 clear to 4,50
This commands let you clear on the specific area of your window/screen.
SET COLOR COMMAND
Syntax: Set colo to [<color set name>]
Set color to [<color set name>]
These commands let you specify the colors of a number of elements of the screen. There are
several common ways to define screen colors with a set color command. You may specify a color
pair list which is a list of between 1 and 10 color pairs separated by commas. These pairs determine
foreground and background colors that appear in different circumstances – font example, W/B, R/B,
W+/B, R+/B. Possible color codes are as follows:
COLORS EQUIVALENT
N BLACK
X BLANK
B BLUE
GR BROWN
BG DYAN
G GREEN
RB MAGENTA
R RED
W WHITE
GR+ YELLOW
CLEAR
Syntax: Clear
Clear All
The clear command by its self clears the screen or the current output window, leaving it blank. The
Options let you specify a number of other items to be cleared from the screen or memory.
INDEX ON COMMAND
Syntax: index on <fieldname> to <indexname>
Sample: index on id to idxid
This command lets you create an index file for a given field specified on the database that you are
using.
USE COMMAND
Syntax: use <driveletter>:\<directory/s>\<filename>.dbf
This command lets you use a database located on the path you have specified. When you use this
command, you will automatically have an access to the database.
REINDEX COMMAND
Syntax: reindex
It will let you refresh or reopen the index you are using.
APPE/APPEND COMMAND
Syntax: Append [<blank>],[<no menu>]
It lets you add data to the end of the current table. First you must open the file with the command
use <file name> if you use this command when no file is open, the open file dialog box is displayed
to let you choose a table.
REPLACE COMMAND
Syntax: Replace SomeField with SomeValue
This command is use to update the value of field in the table using the currently selected record.
STORE COMMAND
Syntax: Store SomeField to SomeValue
This command is the opposite of replace command it allows to store the value of field to currently
selected variable.
SKIP COMMAND
Syntax: skip
This command is lets you jumps on the next record on your database. When you use the use
command, the Beginning of file (BOF) is the one that will be shown/prompt, if you use this
command, it will let you jump to the next record until you reach the End Of File (EOF)
WAIT COMMAND
Syntax: Wait [window] <expression>
This command lets you press any key first before executing the next command. It is optional to use
the key window for you to display the expression in a pink bar at the right top of your screen. When
the key is only wait, it will display the default message “press any key to continue…”.
MENU TO COMMAND
Syntax: MENU TO <variable>
This command is used along with the @ prompt command to implement the light-bar menus.
CLOSE
Syntax: Close
This command closes various types of the files. It must be used with one of the alternatives listed
after it.
Functions
TRIM()
Syntax: trim(<expression>)
This command removes all trailing spaces from the specified character expression.
LTRIM()
Syntax: ltrim(<expression>)
This command removes all leading spaces from the specified character expression.
UPPER()
Syntax: upper(<expression>)
This command is use to return text in upper case format.
LOWER()
Syntax: lower(<expression>)
This command is use to return text in lower case format.
PROPER()
Syntax: proper(<expression>)
It returns text in lowercase text with the initial letters capitalized. Not as useful as you might think
because many proper names include a mixture of uppercase and lowercase letters which must be
retained - "McDonald" and "IBM" for example.
STR()
Syntax: str(<expression>)
It returns number as a string of characters rounded to decimals.
RIGHT()
Syntax: right(<expression>,<no. of characters to be return >)
It returns the rightmost characters. Remember that the count of will include trailing spaces.
LEFT()
Syntax: left(<expression>,<no. of characters to be return >)
It returns the leftmost character. Note that it will be include any spaces.
LEN()
Syntax: right(<expression>)
It returns the length of character- including spaces. Remember this when you are getting the length
of data retrieved from a field.
PICT()
Sample: @ 2,2 say “Try Again? ” get ans pict “y/n” – where only Y or N character where be valid.
DO COMMAND
Syntax: DO <FILENAME>
Sample: do c:\foxpro\hello.prg
ANSWER SHEET # 1
________________ 1. This command is use to display an expression on specified row and column on
the screen.
________________ 2. When this command has been executed, the default location will change to the
path what the user specified.
________________ 3. This command is use to create and open an editing window.
________________ 4. This command is use to display a box.
________________ 5. Same with the @...say command, it also display an expression but it can be
generated to light bar button when the menu to command has been used.
________________ 6. This command is use to display a rectangular shape with either double or tick
border.
________________ 7. This command is used to plan or describe a window needed for your program.
You can define the size, color, border and title of window using this command.
________________ 8. This command displays the window that has been defined when the program
starts the execution.
________________ 9. This command closes the activated window.
________________ 10. This function converts an expression into proper case when used.
________________ 11. It is a command used to specify a color of any expression or object on your
screen.
________________ 12. This commands clears only an specified row and column on your screen
________________ 13. This command clears the whole window when the command has been executed
________________ 14. This command is use to close all windows on FoxPro and terminate the FoxPro
window.
________________ 15. This command is use to close a window.
2. Use command
3. Upper function
4. Trim Function
OPERATION SHEET #3
Purpose: The student will learn how to create a new folder that they will be use
in saving their work.
Condition/situation The System Unit that you’re going to use must be working.
for the operation :
Procedure:
1. Folders are the basic organizational building blocks of any computer system. Without folders it
would be virtually impossible to keep track of all the files that are found on even the smallest
system. New folders can be created just about anywhere, but three methods are shown below.
(Note: Before you start creating a new folder make sure that you’re in the location where the new
folder is to be created. In this case I’m going to use the)
a. Right click anywhere on an open area. Select New and then click Folder. A new
folder with the default name (New Folder) will be created.
b. On the Menu bar select File > New > Folder and the folder will be created in the
right hand pane.
c. In the File and Folder Tasks section, click the Make a New Folder selection. The
New Folder is created in the right hand pane.
2. Lastly rename the folder by typing a new name (the required filename) for the folder and then hit
enter on the keyboard.
Quality Criteria:
1. The folder must be created on the right directory
2. The folder must have the correct folder name.
OPERATION SHEET #4
Procedure:
Editing window is where you type or insert the commands for your program. We have to ways to
create an editing window. Here are the procedures:
1.1 Click the Menu Bar then Select NEW. A dialog box will appear
2.1 On the command prompt type the command “Modify command” (see basic commands
IS).
2.2 Next to the command type the desired name of your editing window.
INFORMATION SHEET # 4
While Creating and running a program, it is very common that you will encounter errors
for your commands. Here are some of the common errors.
a. Syntax Error - refers to an error in the syntax of a sequence of characters that is intended to be written in
a particular programming language.
c. Variable not found – you are trying to use a variable that has not been declared before using.
e. Operator / Operand type mismatch – you are combining two values with different data type.
g. Nesting Error– you have open a logical/structural statement without closing it before running a program
OPERATION SHEET #5
Purpose: The student will learn how to detect minor errors on their program.
Procedure:
2. Select Compile.
3. Wait window will inform you on how many error(s) you have committed.
Wait Window
4. When you reach “0 Compilation errors”, you may now run your program.
Note: 0 Compilation errors don’t mean that your program is free of error(s) because it only
compiles minor errors.
OPERATION SHEET #6
Purpose: The student will learn how to Run the program manually or by typing
the code.
Procedure:
1. Click Program then select Do <name of the program you want to run>.
Select DO located on the lowest part of the menu followed with the name of the program.
JOB SHEET #1
Objective: This job lets the student learn how to create the basic of programming,
displaying an output (message) in a window specified.
Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding the
directory instruction) (see operation sheet # 3 )
2. Open a FoxPro Environment (see operation sheet # 1)
3. Set the directory you create as your default location (see information sheet #
3 for [set default to command])
4. Open/create an editing window with the name “hello.prg”
(See operation sheet # 4)
5. Create a command on the editing window for the output below:
Window name: helloworld
Window coordinates:
S row: 10 E row: 20
S col: 15 E col: 55
Title : “Hello World!”
Border: double with shadow
Learning Experiences
INFORMATION SHEET # 5
FLOWCHARTING
What is a Flow Chart?
A flowchart is a graphical representation of a process or system that details the sequencing
of steps required to create output. This diagrammatic representation can give a step-by-step
solution to a given problem. Data is represented in these boxes, and arrows connecting them
represent flow / direction of flow of data. Flowcharts are used in analyzing, designing, documenting
or managing a process or program in various fields. It also serves as a Blue Print of a program.
Flow Line & Arrow Head Flow line connectors show the
direction that the process flows.
Example:
START
TRUE FALSE
Are you on
your
destination
?
TAKE A STEP
You reached
your
destination
STOP
JOB SHEET # 2
Objective: This job lets the student learn how to create flowchart for a process and
also learn how to use the flowcharting symbols.
Materials/Equipments: Ballpen
Paper
Procedure:
1. List all the materials that will be needed for taking a bath (bucket bath).
2. List step by step process on how to do the job(taking a bath).
3. Create a flow chart for the steps you have listed.
ANSWER SHEET # 2
________________ 1. This sysmbol indicates the question in the flowchart. It has the only symbol
that has two different outgoing path.
________________ 3. It specify that the continuation of the flowchart is on the same page.
________________ 7. This connector represent the connection of the flow at different pages.
________________ 8. A symbol use to show the start and end of the flowchart.
________________ 9. It shows the directions and connect all the symbols in a flowchart.
________________ 10. This symbol define another block statements of the process.
2. _____________ 4. _____________
INFORMATION SHEET # 6
VARIABLES
What is a Variable?
A variable is a facility for storing data. Variables are the memory locations which are used to
store values temporarily. It is use to hold particular or specific value that may vary. A variable is also
identified as a container.
A Data Type (or DataType) is a classification identifying one of various types of data, as
floating-point, integer, or Boolean, stating the possible values for that type, the operations that can
be done on that type, and the way the values of that type are stored.
In declaring a variable you must know how to declare it properly and correctly. Here are the
proper and correct formats of declaring a variable in FoxPro. For each of the data type.
Using Variable
You can get a value from the user or use variables as an expression, if you want to display the
variable, don’t forget its datatype. You may type it after a string expression on the @ say command,
you can also use it after the @ get command to get a value from the user, or display it as another
message if it is a numeric or date datatype. Just don’t put/write double quote (“) before and after
the variable.
JOB SHEET # 3
Objective: This job lets the student learn how to create the program using variable.
Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding
the directory instruction) (see operation sheet # 3 )
2. Open a FoxPro Environment (see operation sheet # 1)
3. Set the directory you create as your default location (see information
sheet # 3 for [set default to command])
4. Open/create an editing window with the name “hello2.prg”
(See operation sheet # 4)
5. Create a command on the editing window for the output below:
Window name: hello2
Window coordinates:
S row: 5 E row: 24
S col: 10 E col: 70
INFORMATION SHEET # 7
OPERATORS
We use this operators to perform deffirent task in our program. For example we use
arithmetic operators and assignment operator to assigned a value to a variable or constant value, or
also to create a formula/equation.
Sample : varname = “melcris” (we use assignment operator to assign a value to a variable)
Varsum = varnum1 + num2 (we create an equation to get a sum of two variables)
Logical operators and Relational operators are used in conditions and other logical executions on
the program (will be discussed to the next topic).
JOB SHEET # 4
Objective: This job lets the student learn how to create the program using variable
and create formula and equations using operators.
Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding
the directory instruction) (see operation sheet # 3 )
3. Set the directory you create as your default location (see information
sheet # 3 for [set default to command])
S row: 2 E row: 24
S col: 2 E col: 75
Title : “Calculator”
Border: double with shadow
a. Get 2 inputed values from the user to be stored to variables num1 and
num2.
b. Formulate a value for sum,difference,product and quotient of num1 and
num2 to be stored in the variables sum,diff,prod,quo.
c. Formualte a value for the averrage of sum,difference,quotient and
product to be stored in variable ave.
d. Display all the value of the variables.
INFORMATION SHEET # 8
The computer has the capability to make decisions based on a given set of conditions and choices.
This can be done through the application of conditional statements and iterations in our program.
CONDITIONAL STATEMENT
Condition – is a question answerable only by yes or no, true or false. Here are the conditional
statements that you can use in FoxPro:
Syntax: if (condition )
Statement if true
else
statement if false
endif
Sample: varage = 0
@ 2,2 say “Enter your age: ”get age
read
if varage > 18
@ 4,2 say “You are Qualified to vote”
Else
@ 4,2 say “You are too young”
Endif
Flowchart:
F T
Condition
Actually, the else part is optional which means that it can be included or not in our program;
(our program will still run even without else statement). When the condition isproven true, it will
execute the statement under the true and before else, otherwise statement after else and before
endif will be executed. In the absence of else statement, there is nothing to be executed in case
condition has result to false. The endif keyword tells that it is the end of the structure and it will
execute the statement after the structure regardless of the result of the condition.
Nested if statement is an inner if..else statement inside another if…else statement. In this
conditional statement, the inner if conditional statement would only be executed if the outer if
conditional statement is evaluated to true, otherwise the last else conditional statement will be
executed.
If the our if conditional statement is evalated to true then the inner if (conditional statement) is
executed. Since this inner if is also a conditinal statement, therefore it will also be evaluated. If the
evaluation results to true, then its associated statement would be executed, otherwise its inner else
partener would be executed:
Syntax: if (condition1)
If (condition2)
Statement if true
Else
Statement if false
Else
Statement if false
Endif
Sample: age = 0
If age >= 1 and age <=100
If age> 18
@ 2,2 say “Qualified to vote”
Else
@ 2,2 say “Too young”
Else
@ 2,2 say “Out of range”
Endif
Note: To analys the structure easily, always indent your program code properly.
According to the rule of syntax, the nearest if statement is the partner of the else statement.
Without knowing this ruel, yo would endup guessing.
DO/CASE STATEMENT
Do/case conditional statement is a multi-way decision that tests whether one of the conditions
results to true. With the do/case conditional statement, we can simplify some of the tasks that are
long and cumbersome using the nested if conditional statement.
Flowchart:
F T
Condition
1
F T Statement if true
Condition
2
Statement if true
Statement if false
LOOPING/ITERATION
The looping statement is a program instruction that repeats some statement or sequence of
statements is a specified number of times. Looping statement allow a set of instructions to be
performed all over again until a certain condition is reached, met, or proven and tested as false.
This looping statements executes a task or command under the do while and before the
enddo while and only while the condition has been proven true. Once the condition turns to false,
the command after enddo will then be executed. The initialization variable specifies the first value
whre the loop starts. If the initialization turns out the condition to be false at the start, the statement
between the do while and enddo will not be executed (nothing will happen, it will just execute the
next command to enddo).
Syntax: initialization
do while (condition)
Statement if true
enddo
Sample: a=0
Do while a < 5
@ a,2 say “ The value of a is ” + str(a)
Enddo
Output:
The value of a is 0
The value of a is 1
The value of a is 2
The value of a is 3
The value of a is 4
Flowchart:
Initialization
F T
Condition
1
Statement if true
JOB SHEET # 5
Objective: This job lets the student learn how to create the program using conditional
statements
Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding
the directory instruction) (see operation sheet # 3 )
3. Set the directory you create as your default location (see information
sheet # 3 for [set default to command])
Window coordinates:
S row: 15 E row: 28
S col: 15 E col: 60
Title : “DayMonth”
a. Get value of month from the user. The format of month must be on
proper casing only and must not accept numbers.
b. Display the number of days for the inputted month.
c. Get value of year only if the inputted value of the user is February.
d. Display “There are 28 days in February ” if the year is not a leaf year
e. Display “There are 29 days in February ” if the year is divisible by four.
f. The program must ask the user if he/she wants to try again, if the user
press y the program will be repeated. The program will only be
terminated once the user press n.
Output:
JOB SHEET # 6
Objective: This job lets the student use the combination of using variables,
conditional statements, iterations and other functions.
Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding
the directory instruction) (see operation sheet # 3 )
3. Set the directory you create as your default location (see information
sheet # 3 for [set default to command])
Window coordinates:
S row: 2 E row: 35
S col: 2 E col: 78
Formula:
Attendance = 10 percent of the inputted attendance
Performance = 20 percent of the inputted performance
Quizzes = 30 percent of the Average inputted quizzes
(q1, q2, q3, q4)
Exam = 40 percent of the inputted exam
Grade = sum of the percentage attendance,
performance, quizzes, and exam
Remark:
Failed = If the student get a grade less than 75
Passed = if the student get a grade higher or equal to 75
Output:
Learning Experiences
INFORMATION SHEET # 9
WHAT IS DATABASE?
Database
A database can be defined as a structured collection of records or data that is stored in a computer
so that a program can consult it to answer queries. The records retrieved in answer to queries
become information that can be used to make decisions. The computer program used to manage
and query a database is known as a database management system (DBMS). The properties and
design of database systems are included in the study of information science.
The term "database" originated within the computing discipline. Database-like records have been in
existence since well before the industrial revolution in the form of ledgers, sales receipts and other
business related collections of data.
Fields
In the context of a relational database table, a column is a set of data values of a particular simple
type, one for each row of the table.[1] The columns provide the structure according to which the
rows are composed. The term field is often used interchangeably with column, although many
consider it more correct to use field (or field value) to refer specifically to the single item that exists
at the intersection between one row and one column.
Records
A row—also called a record or tuple—represents a single, implicitly structured data item in a table.
In simple terms, a database table can be thought of as consisting of rows and columns or fields.
Each row in a table represents a set of related data, and every row in the table has the same
structure.
Index
A database index is a data structure that improves the speed of data retrieval operations on a
database table at the cost of slower writes and increased storage space. Indexes can be created
using one or more columns of a database table, providing the basis for both rapid random look ups
and efficient access of ordered records. The disk space required to store the index is typically less
than that required by the table (since indexes usually contain only the key-fields according to which
the table is to be arranged, and excludes all the other details in the table), yielding the possibility to
store indexes in memory for a table whose data is too large to store in memory.
In most cases, an index is used to quickly locate the data record(s) from which the required data is
read. In other words, the index is only used to locate data records in the table and not to return data.
A covering index is a special case where the index itself contains the required data field(s) and can
return the data.
OPERATION SHEET # 7
2. Select Database then click on Ok on the dialog box that will appear
3. On another box that will appear, type the name of the field.
4. Select the Data type of the field you declared, then on the with dec part, type the
length of the field you have defined.
5. Once you already finish in typing the fields, you can now click ok.
6. Another dialog box will appear, here type the filename of the database you are creating
and select the directory or path where you are going to save your database.
7. Clicks save. A message will appear saying “Input data records now?” It’s up to you if you
want to go directly to go to the database and insert a record. (But it is recommended to
select NO since we will be creating a dataentry program on the next topic)
OPERATION SHEET #8
1. First, be sure that the database you will be modifying is currently in use, if not you can
use the USE command or open the database first. (see syntax for USE command – IS#3)
2. Click on the database option at the menu bar, and then click setup.
3. The Structure of your database will appear on the dialog box, to modify the fields or to
add another field click on modify.
4. The same with creating database dialog box will appear, you can now add, or edit the
field you want.
5. Click OK when you are finish. Then another OK to close and save the changes for
modifying the database you select.
OPERATION SHEET #9
3. The Structure of your database will appear on the dialog box, to modify the fields
or to add another field click on modify.
4. On the right side of the dialog box (look for ADD), click the Add button. On the
dialog box appeared, select the directory where you are going to save your index,
then click on new.
5. a.) Select the field you will indexing, b.) On the output section, select the IDX option, c.)
Type the name of the index on the save as… text box (sample: idxid.idx), d.) Click on OK.
You will be asked if you want to include the field on the index, click yes then click OK to
finish adding the index.
A B
JOB SHEET # 7
Objective: This job lets the student learn how to create database and add index.
Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding
the directory instruction) (see operation sheet # 3 )
3. Set the directory you create as your default location (see information
sheet # 3 for [set default to command])
5. After, creating the database, create an index for your field id with the
index name “indexid.idx”
JOB SHEET # 8
Objective: This job lets the student learn to create a program that adds data to the
database automatically using the append and replace command.
Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding
the directory instruction) (see operation sheet # 3 )
3. Set the directory you create as your default location (see information
sheet # 3 for [set default to command])
Window coordinate:
Srow: 2 Erow : 35
Scol :2 Ecol : 78
Conditions:
The height and weight must only accept numbers.
The gender and status must accept only one digit number
according to the available options
Birthday must accept only valid date.
The format of ID number is in this pattern
“# # # # - # # # # - # #”
Desired output:
defi wind entry from 2,2 to 32,78 title "Data Entry Program" foot "ACEBA Systems
Technology Institute" doub
acti wind entry
ans="y"
do while ans="y"
eidnum=space(15)
ename=space(30)
eaddress=space(40)
egender=space(1)
estatus=space(1)
ebday=date()
econtact=space(11)
ereligion=space(15)
eheight=space(6)
eweight=space(6)
ans1=space(1)
@1,1,3,40 box
@2,5 say "ID Number : "get eidnum pict "####-####-##"
read
use c:\myfolder\datainfo.dbf
inde on id to eidnum
set index to eidnum
reindex
seek eidnum
if found ()
@10,15 say "The Record Already Exist"
else
@5,1,33,74 box
@6,5 say "Name : "get ename
@6,50 say "Birthday :"get ebday
@8,5 say "Address : "get eaddress
@10,5 say "Contact : "get econtact
@12,5 say "Religion : "get ereligion
@14,5 say "Height : "get eheight pict "###.##"
@14,19 say "cm"
@16,5 say "Weight : "get eweight pict "###.##"
@16,19 say "lbs."
@10,35,16,50 box
@10,37 say "Gender : "get egender
@10,55,16,72 box
@10,57 say "Status : "get estatus
@12,37 say "1.Male"
@14,37 say "2.Female"
@12,57 say "1.Single"
@13,57 say "2.Married"
@14,57 say "3.Widow/Widower"
@15,57 say "4.Separated"
@18,3,20,72 box
endif
@24,3,26,72 box
@25,5 say "Do you want to Enter Another Record?[Y/N]"get ans
read
@2,00 clear to 24,78
enddo
JOB SHEET # 9
Objective: This job lets the student learn to create a program that search and display
specific records from the database using the index, seek and store
command
Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding
the directory instruction) (see operation sheet # 3 )
3. Set the directory you create as your default location (see information
sheet # 3 for [set default to command])
Window coordinate:
Srow: 2 Erow : 35
Scol :2 Ecol : 78
Name Birthday
Address Gender
Status Contact
Religion Height
Weight
Desired Output:
defi wind seek from 2,2 to 32,78 title "Search Program" foot "ACEBA Systems
Technology Institute" doub
acti wind seek
ans="y"
do while ans="y"
eidnum=space(15)
@1,1,3,40 box
@2,5 say "ID Number : "get eidnum pict "####-####-##"
read
use c:\myfolder\datainfo.dbf
seek eidnum
if found ()
store name to ename
store birthday to ebday
store address to eaddress
store contact to econtact
store religion to ereligion
store height to eheight
store weight to eweight
store gender to igender
store estatus to istatus
@5,1,33,74 box
@6,5 say "Name : "+ ename
@8,5 say "Birthday :"+ dtoc(ebday)
@10,5 say "Address : "+ eaddress
@12,5 say "Contact : "+ str(econtact)
@14,5 say "Religion : "+ ereligion
if igender="1"
egender="Male"
else
if igender="2"
egender="Female"
else
@20,15 say "Invalid gender"
endif
endif
if istatus="1"
estatus="Single"
else
if istatus="2"
estatus="Married"
else
if istatus="3"
estatus="Widow/Widower"
else
if istatus="4"
estatus="Separated"
else
@22,15 say "Invalid Status"
endif
endif
endif
endif
else
@10,15 say "Sorry! No Record Match"
endif
@24,3,26,72 box
@25,5 say "Do you want to Search Another Record?[Y/N]"get ans
read
@2,00 clear to 30,78
enddo
JOB SHEET # 10
Objective: This job lets the student learn to create a program that search and modify
specific records from the database using the index, seek and store, and
replace command
Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding
the directory instruction) (see operation sheet # 3 )
3. Set the directory you create as your default location (see information
sheet # 3 for [set default to command])
Window coordinate:
Srow: 2 Erow : 35
Scol :2 Ecol : 78
After the user change the data, the program must ask the user
if he/she wants to save the changes to the records. If the user
type “Y” then the program must overwrite the old data in the
database and display a confirmation. But if the user presses N
a message must appear saying “Record not changed!” Only Y
or N is valid keys whether it is in upper or lower case.
Desired Output:
1. If the ID NUMBER matches to a record on the database
defi wind edit from 2,2 to 32,78 title "Edit Program" foot "ACEBA Systems
Technology Institute" doub
acti wind edit
ans="y"
do while ans="y"
eidnum=space(15)
ans1=space(1)
@1,1,3,40 box
@2,5 say "ID Number : "get eidnum pict "####-####-##"
read
use c:\myfolder\datainfo.dbf
seek eidnum
if found ()
@5,1,33,74 box
@6,5 say "Name : "get ename
@6,50 say "Birthday :"get ebday
@8,5 say "Address : "get eaddress
@10,5 say "Contact : "get econtact
@12,5 say "Religion : "get ereligion
@14,5 say "Height : "get eheight
@16,5 say "Weight : "get eweight
@10,35,16,50 box
@10,37 say "Gender : "get egender
@10,55,16,72 box
@10,57 say "Status : "get estatus
@12,37 say "1.Male"
@14,37 say "2.Female"
@12,57 say "1.Single"
@13,57 say "2.Married"
@14,57 say "3.Widow/Widower"
@15,57 say "4.Separated"
@18,3,20,72 box
@19,5 say "Save the Changes?[Y/N]"get ans1
read
@21,3,23,72 box
if ans1="y"
use c:\myfolder\datainfo.dbf
else
@10,15 say "Sorry! No Record Match!"
endif
@24,3,26,72 box
@25,5 say "Do you want to Edit Another Record?[Y/N]"get ans
read
@2,00 clear to 24,78
enddo
JOB SHEET # 11
Objective: This job lets the student learn to create a program that search and delete
specific records from the database using the index, seek, delete and pack
command
Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding
the directory instruction) (see operation sheet # 3 )
3. Set the directory you create as your default location (see information
sheet # 3 for [set default to command])
Window coordinate:
Srow: 2 Erow : 35
Scol :2 Ecol : 78
Desired Output:
defi wind delete from 2,2 to 36,78 title "Delete Program" foot "ACEBA Systems
Technology Institute" doub
acti wind delete
ans="y"
do while ans="y"
eidnum=space(15)
@1,1,3,40 box
@2,5 say "ID Number : "get eidnum pict "####-####-##"
read
use c:\myfolder\datainfo.dbf
seek eidnum
if found ()
store name to ename
store birthday to ebday
store address to eaddress
store contact to econtact
store religion to ereligion
store height to eheight
store weight to eweight
store gender to igender
store estatus to istatus
@5,1,33,74 box
@6,5 say "Name : "+ ename
@8,5 say "Birthday :"+ dtoc(ebday)
@10,5 say "Address : "+ eaddress
@12,5 say "Contact : "+ str(econtact)
@14,5 say "Religion : "+ ereligion
if igender="1"
egender="Male"
else
if igender="2"
egender="Female"
else
@20,15 say "Invalid gender"
endif
endif
if istatus="1"
estatus="Single"
else
if istatus="1"
estatus="Married"
else
if istatus="1"
estatus="Widow/Widower"
else
if istatus="1"
estatus="Separated"
else
@22,15 say "Invalid Status"
endif
endif
endif
endif
else
@10,15 say "Sorry! No Record Match"
endif
@29,3,31,72 box
@30,5 say "Do you want to Search Another Record?[Y/N]"get ans
read
@2,00 clear to 36,78
enddo
JOB SHEET # 12
Objective: This job lets the student learn to create a program that will display all the
records on the database starting from the BOF until EOF. The student will
also learn how to use the skip and wait command.
Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding
the directory instruction) (see operation sheet # 3 )
3. Set the directory you create as your default location (see information
sheet # 3 for [set default to command])
Window coordinate:
Srow: 2 Erow : 35
Scol :2 Ecol : 78
ID Number birthday
Name Contact
Gender
Only 18 rows (records) must be displayed.
The other record will be shown next once the user press a key
Desired Output:
if igender="1"
egender="Male"
else
if igender="2"
egender="Female"
else
@20,15 say "Invalid gender"
endif
endif
if istatus="1"
estatus="Single"
else
if istatus="1"
estatus="Married"
else
if istatus="1"
estatus="Widow/Widower"
else
if istatus="1"
estatus="Separated"
else
@22,15 say "Invalid Status"
endif
endif
endif
endif
@x,5 say id
@x,15 say name
@x,25 say birthday
@x,35 say address
@x,45 say contact
@x,55 say religion
@x,65 say gender
@x,75 say estatus
x=x+1
enddo
deact wind view
Learning Experiences
INFORMATION SHEET # 10
You now have your Data Entry, Search, Edit, Delete and View program. All you need to do
now is to compile it to make it a system; we will now be creating a Main Menu program. Main menu
program is compose of light-bar buttons (menus) so that the user can select and press on the
button then the program they desired will appear. Using this menu the user can easily access the
system we have created.
A series of @-PROMPT commands is first used to display the desired menu options at specific
positions on the screen. The format for this command is
Where the character expression that follows the PROMPT clause appears in a bar at the specified
row and column position. The MESSAGE clause is optional. If it is used, the character expression
that follows MESSAGE will appear in the message area of the screen whenever that particular
menu option is highlighted.
A series of @-PROMPT commands are followed by a MENU TO command. The format of this
command is
MENUT TO memory-variable
It activates the menu choices defined with the PROMPT command and waits for a user response.
The user can highlight the desired menu option and press [ENTER], at which time a numeric value
representing the chosen menu option gets passed on the memory variable specified in the MENU
TO command. For example, if the user highlight the first menu option and presses [ENTER], 1 gets
stored to the variable. If the user highlights the fourth menu option and presses [ENTER], 4 get
stored to the variable.
Once the user presses [ENTER], nothing will happen since there is no specific command under
each light bar, to create an execution, you can use the do case or any conditional statement that will
check the value of the variable and execute a certain command once a value has been meet. Here
is the example program;
ans = 0
menu to ans
do case
case ans = 1
do hello.prg
case ans = 2
do calc.prg
case ans = 3
quit
endcase
JOB SHEET # 13
Objective: This job lets the student learn to create a menu for their system. In this
job, they will use the menu to, @ prompt, and do command.
Procedure:
1. Create a folder on Local Disk (C:\) (or follow the instructor regarding
the directory instruction) (see operation sheet # 3 )
3. Set the directory you create as your default location (see information
sheet # 3 for [set default to command])
Window coordinates:
Srow: 6 Erow : 24
Scol : 2 Ecol : 78