Vous êtes sur la page 1sur 211

By

CONTENTS

Topics Page No.

1. Overview of Business System 1


2. Functions of Management 3
3. Levels of Management 5
4. Data Handling 9
5. Concept of Files 24
6. Business Data Processing 29
7. Concept of Programming 33
8. Program Design 35
9. An Introduction to Visual FoxPro 36
10. Concept of DataBase Management System (DBMS) 37
11. Starting Visual FoxPro 38
12. Introduction to Programming 62
13. Some Useful Commands 86
14. Tables in Visual FoxPro 139
15. Creating Queries 158
16. Creating Forms 168
17. Creating Reports 177
18. Using Labels 187
19. Mail Merge 192
20. Cross-Tab Wizards 198
21. Structured Query Language (SQL) 201
22. Business Applications 204
BUSINESS SYSTEM Developed By Sangita Pal

Overview of Business Systems

Definition
It is the methodical procedure or process, used as a delivery mechanism for providing
specific goods or services to customers in a well defined market.

• A business (also called a firm or an enterprise) is a legally recognized organization


designed to provide goods and/or services to consumers. ...
• A method or procedure for executing a business process or processes.
• A system which facilitates a business process.
• A combination of people and automated applications organized to meet a
particular set of business objectives.
• A group of related records that contain common data with areas where additional
are data to be entered.

Formation of Business Policy


• The mission of the business is its most obvious purpose
• The vision of the business reflects its aspirations and specifies its intended
direction or future destination.
• The objectives of the business refer to the ends or activity at which a certain task
is aimed.
• The business's policy is a guide that stipulates rules, regulations and objectives,
and may be used in the managers' decision-making. It must be flexible and easily
interpreted and understood by all employees.
• The business's strategy refers to the coordinated plan of action that it is going to
take, as well as the resources that it will use, to realize its vision and long-term
objectives. It is a guideline to managers, stipulating how they ought to allocate
and utilize the factors of production to the business's advantage. Initially, it could
help the managers decide on what type of business they want to form.

TECHNO INDIA GROUP Page No-1


BUSINESS SYSTEM Developed By Sangita Pal

How to implement Policies and Strategies

• All policies and strategies must be discussed with all managerial personnel and

staff.

• Managers must understand where and how they can implement their policies and

strategies.

• A plan of action must be devised for each department.

• Policies and strategies must be reviewed regularly.

• Contingency plans must be devised in case the environment changes.

• Assessments of progress ought to be carried out regularly by top-level managers.

• A good environment and team spirit is required within the business.

• The missions, objectives, strengths and weaknesses of each department must be

analyzed to determine their roles in achieving the business's mission.

• The forecasting method develops a reliable picture of the business's future

environment.

• A planning unit must be created to ensure that all plans are consistent and that

policies and strategies are aimed at achieving the same mission and objectives.

All policies must be discussed with all managerial personnel and staff that are required in
the execution of any departmental policy.

TECHNO INDIA GROUP Page No-2


BUSINESS SYSTEM Developed By Sangita Pal

Management

Definition

Management in all business and human organization activity is simply the act of getting
people together to accomplish desired goals and objectives. Management comprises
planning, organizing, staffing, leading or directing, and controlling an organization (a
group of one or more people or entities) or effort for the purpose of accomplishing a goal.
Resorting encompasses the deployment and manipulation of human resources, financial
resources, technological resources, and natural resources.

Characteristics of a Manager

• A manager who happens to manage a farm or horticultural business.

• A manager challenged to make efficient use of resources.

• A manager challenged with getting things done through people.

• A manager who has opportunity to use of all the tools of management that any

other manager uses.

TECHNO INDIA GROUP Page No-3


BUSINESS SYSTEM Developed By Sangita Pal

Five Functions of Management

Planning is the ongoing process of developing the business mission and objectives and
determining how they will be accomplished. Planning includes both the broadest view of
the organization, e.g., its mission, and the narrowest, e.g., a tactic for accomplishing a
specific goal.

Organizing is establishing the internal organizational structure of the organization. The


focus is on division, coordination, and control of tasks and the flow of information within
the organization. It is in this function that managers distribute authority to job holders.

Staffing is filling and keeping filled with qualified people all positions in the business.
Recruiting, hiring, training, evaluating and compensating are the specific activities
included in the function. In the family business, staffing includes all paid and unpaid
positions held by family members including the owner/operators.

Directing is influencing people's behavior through motivation, communication, group


dynamics, leadership and discipline. The purpose of directing is to channel the behavior
of all personnel to accomplish the organization's mission and objectives while
simultaneously helping them accomplish their own career objectives.

Controlling is a process of establishing performance standards based on the firm's


objectives, measuring and reporting actual performance, comparing the two, and taking
corrective or preventive action as necessary.

Each of these functions involves creative problem solving. Creative problem solving is
broader than problem finding, choice making or decision making. It extends from analysis
of the environment within which the business is functioning to evaluation of the outcomes
from the alternative implemented.

TECHNO INDIA GROUP Page No-4


BUSINESS SYSTEM Developed By Sangita Pal

Levels of Management

The term “Levels of Management’ refers to a line of demarcation between various


managerial positions in an organization. The number of levels in management increases
when the size of the business and work force increases and vice versa. The level of
management determines a chain of command, the amount of authority & status enjoyed
by any managerial position.

The levels of management can be classified in three broad categories: -

1. Top level / Administrative level


2. Middle level / Executors
3. Low level / Supervisory / Operative / First-line managers

Managers at all these levels perform different functions. The role of managers at all the
three levels is discussed below:

LEVELS OF MANAGEMENT

TECHNO INDIA GROUP Page No-5


BUSINESS SYSTEM Developed By Sangita Pal

1. Top Level of Management

It consists of board of directors, chief executive or managing director. The top


management is the ultimate source of authority and it manages goals and policies for an
enterprise. It devotes more time on planning and coordinating functions.

The role of the top management can be summarized as follows –


a. Top management lays down the objectives and broad policies of the enterprise.

b. It issues necessary instructions for preparation of department budgets, procedures,

schedules etc.

c. It prepares strategic plans & policies for the enterprise.

d. It appoints the executive for middle level i.e. departmental managers.

e. It controls & coordinates the activities of all the departments.

f. It is also responsible for maintaining a contact with the outside world.

g. It provides guidance and direction.

h. The top management is also responsible towards the shareholders for the

performance of the enterprise.

2. Middle Level of Management

The branch managers and departmental managers constitute middle level. They are
responsible to the top management for the functioning of their department. They devote
more time to organizational and directional functions. In small organization, there is only
one layer of middle level of management but in big enterprises, there may be senior and
junior middle level management.

TECHNO INDIA GROUP Page No-6


BUSINESS SYSTEM Developed By Sangita Pal

Their role can be emphasized as-

a. They execute the plans of the organization in accordance with the policies and

directives of the top management.

b. They make plans for the sub-units of the organization.

c. They participate in employment & training of lower level management.

d. They interpret and explain policies from top level management to lower level.

e. They are responsible for coordinating the activities within the division or

department.

f. It also sends important reports and other important data to top level management.

g. They evaluate performance of junior managers.

h. They are also responsible for inspiring lower level managers towards better

performance.

3. Lower Level of Management


Lower level is also known as supervisory / operative level of management. It consists of
supervisors, foreman, section officers, superintendent etc. In other words, they are
concerned with direction and controlling function of management.

Their activities include –


a. Assigning of jobs and tasks to various workers.

b. They guide and instruct workers for day to day activities.

c. They are responsible for the quality as well as quantity of production.

d. They are also entrusted with the responsibility of maintaining good relation in the

organization.

TECHNO INDIA GROUP Page No-7


BUSINESS SYSTEM Developed By Sangita Pal

e. They communicate workers problems, suggestions, and recommendatory appeals

etc to the higher level and higher level goals and objectives to the workers.

f. They help to solve the grievances of the workers.

g. They supervise & guide the sub-ordinates.

h. They are responsible for providing training to the workers.

i. They arrange necessary materials, machines, tools etc for getting the things done.

j. They prepare periodical reports about the performance of the workers.

k. They ensure discipline in the enterprise.

l. They motivate workers.

m. They are the image builders of the enterprise because they are in direct contact

with the workers.

TECHNO INDIA GROUP Page No-8


BUSINESS SYSTEM Developed By Sangita Pal

Data Handling

Effective functioning of any organization depends on existence of a system that manages


flow of data and supplies relevant information to concerned decision makers.

This system is the means by which data flows from one person or department to another.
It can encompass everything from inter-office mail and telephone links to a computer
system that generates periodic reports for various users.

Information systems serve all the functions or departments of a business, linking them in
such a way that they effectively work towards the organizational purpose.

Modern organizations have to maintain large volumes of data about various entities
of interest— products, processes, people, customers, competitors, equipment, facilities,
and suppliers.

Therefore, efficient data management/information systems are essential for


managing organizations effectively.
Data is the basic building block of organizational information system.

Identification of Relevant Data

The performance of the manager can suffer on counts, getting too little information or
getting too much information.

Therefore, it is important to identify what is relevant information for the decision maker.
To accomplish this task, one must have a thorough understanding of the data elements for
the proposed system.

TECHNO INDIA GROUP Page No-9


BUSINESS SYSTEM Developed By Sangita Pal

Proposed Strategy: (accomplished by end users)

♦ Pick a form, document, printout of a file, report, or other source of data.

♦ Circle each unique item on the document.

♦ Draw an X through circled items that will not be stored by the new system.

♦ Draw an X through extraneous items such as signatures.

♦ Put an X through constant information.

♦ Verify the remaining data elements with end users.

Another technique for identifying elements is brainstorming. Pick an entity and ask
yourself what characteristics (data) describe that entity.

Entity
An entity is a person, place, thing, event, or concept about which information is recorded.

Attributes of Entity

Every entity has some basic attributes that characteristically describe it.
In computer terminology an attribute is often called:
Data element,
Data field or just field,
Data item, or
Elementary item

Attributes of an entity may be "quantitative" or "qualitative". For example, numbers of


parts in stock and basic salary are quantitative, while address, name, and part description
are qualitative data.

TECHNO INDIA GROUP Page No-10


BUSINESS SYSTEM Developed By Sangita Pal

Data Value
A data value is the actual data or information which the attribute of an entity takes.
It is also referred to as an instance of the attribute.
Example: Relationship between Entity, Attribute, and Data

Data Elements by Function

• Transactional Data Elements

Most data in a business are created by transactions.


Examples: The sale of a product generates values for such transactional data elements as:
Product description
Quantity sold
Gross sale value
Similarly, the payments made to a vendor will generate accounting transaction data.

• Reference Data Elements

Some data in a business are generated for the purpose of reference.


Example: Consider a sales transaction. When the sale is made, an invoice or a cash memo
is prepared and the transaction data are recorded in relevant document.
However, in the course of a business, it is often necessary to trace and refer to
that transaction. So a reference number is given to the invoice number, sales
order number, and invoice or cash memo.

Thus we have the reference data elements serving two purposes:


♦ They identify data elements.
♦ They provide linkage between transactions.
These data elements are also treated as "Key Data Elements" or "Keys".

TECHNO INDIA GROUP Page No-11


BUSINESS SYSTEM Developed By Sangita Pal

• Data Elements for Planning


Some data are not generated due to a transaction but are created on the basis of:
Policy decision,
Analysis of historical data, or
Judgement
Example: Budgeted sales data or cost co-efficients used in costing are such data
elements.

• Control-Related Data Elements


Some data elements are generated for control purposes by the management.
Example: An upper limit of credit may be specified for customers. When the credit
exceeds this limit, the management is informed.
Similarly, control limit may be set for budgeting, quotas, and advertising.

• Security-Related Data Elements


To guard against unauthorised access to data, users are often assigned codes. These codes
are related to the security of the system and, hence, may be called "security- related data
elements".
Thus, one code may regulate access to data, and another may regulate what the user
can do with the data.

• Validation Data Elements


Some data are used to ensure completeness and accuracy of processing.
Example: While processing a batch of invoices, the total value of all invoices can be
provided as validation data. The computer, while processing the invoices,
will calculate this total and match with the one that is provided.

If these do not match, further processing may be discontinued. Such totals are known
as "Batch/Hash Totals".

TECHNO INDIA GROUP Page No-12


BUSINESS SYSTEM Developed By Sangita Pal

Data Elements By Source


• Raw or Input Data
New variable data entering the system for the first time.
The data that are not derived from any other data elements.
Example: Description of a new product, name of a new employee, and quantity sold.
Sometimes raw data may be in coded forms, for example, instead of department name, a
code can be assigned to the value.

• Stored Data
A lot of data are stored in the system in computer files that may be required for
processing purposes at various points in time.
Examples: Employee data
Product data
Sales data
Budget data
Cost data

• Derived Data
Derived data are the result of processing or manipulation of raw or stored data.
Example: Invoice value in an invoice can be determined from quantity sold and unit
price.

Primary and Secondary Data Elements

Primary key is the key data element that will identify the entity uniquely. With this data
element we can enter other data elements. It is possible that there are two or more data
elements that can uniquely identify an entity.

Example: A student can be identified uniquely both by his/her roll number as well
as student registration number.

TECHNO INDIA GROUP Page No-13


BUSINESS SYSTEM Developed By Sangita Pal

Data elements other than the primary data element are called secondary data
elements.

Example: For an invoice, invoice number is the primary key and other details such
as its date, customer number, and value are secondary data elements.

Historical Data
Used for reference and analysis purposes. Organization stores data for planning,
forecasting, and taking different decisions and actions. These actions are largely based on
the historical data.

Need for Ensuring Accurate, Reliable, and Timely Processing of Data


Information has economic value-costs, benefits, and opportunity costs. Therefore, we
would like to maximize its value.

• Accuracy
It is a ratio of correct information to the total amount of information produced over a
period.

• Reliability
Ensures that system should not produce dangerous or costly failures when it is used in a
reasonable way.

• Timeliness
The value of information also depends on when it is made available to the decision maker
and how quickly system responds to user request for information.

All these qualities of information are major concerns of the information system manager.
Not only the information must be readily available but if not stored properly, intact in a
classified and indexed manner, its retrieval time will be high even for a computer.

TECHNO INDIA GROUP Page No-14


BUSINESS SYSTEM Developed By Sangita Pal

Basic Tasks in Business Data Processing

Data processing is the restructuring, manipulation, or recording of data by people or


machine, to increase their usefulness and value for some particular purpose.
Following are the basic functions carried out in any data processing:

• Origination
The first function involved in the processing of data is the original of the data to be
processed. Specifically, the nature, type, and origin of the source documents must be
determined, such as sales orders and purchase orders.

• Data Capture
Data must be recorded or captured in some form or the other before it can be processed.
What data are important and should be collected for input and processing depend upon
the organization and the system.

Data may be captured in paper-forms using source documents and in paper-less forms
through:
♦ Keyboards
♦ Automated Teller Machines
♦ Other direct input devices that accept input data in machine readable form.

• Sorting
Normally, it is easier to work with data if it is arranged in a logical sequence.
Examples: First to last time sequence
Biggest to smallest
Oldest to newest
Arranging classified data in such a sequence is called "sorting".

TECHNO INDIA GROUP Page No-15


BUSINESS SYSTEM Developed By Sangita Pal

• Merging
This function allows multiple files to be put together in a sequence, provided the files are
already in sorted order.
Example: A file of new customers could be merged into an existing customer
master file that is stored on a magnetic disk in customer number sequence.

• Calculating
The arithmetic manipulation of data to create meaningful results is known as calculating.
It is a common data processing task.
This process is usually the most significant part of the manipulation operation
because the results are generally provided as part of the output.

• Summarizing
Reducing masses of data to a more concise and usable form is called summarizing.
Generally, the data is summarized into form desired for output.
Example: Pie charts, Bar charts, other graphs

These are few of the many computer-generated graphics that are used to view data at a
glance.

Managing Output Results


Once data have been captured and manipulated, one or more of the following operations
may be needed:

Output
After the various operations on the data have been completed, the delivery or
communication of the information or results must be carried out by:
♦ Reporting, which is the format presentation and distribution of processed data?.
♦ Issuance of documents, such as cheques, invoices, and reports.

TECHNO INDIA GROUP Page No-16


BUSINESS SYSTEM Developed By Sangita Pal

♦ Retrieval, which is the fetching of a specific item or items of stored information


at the request of a user.
♦ Analysis, which encompasses all of the ways in which receivers utilize output,
that is, use the information provided by the system.
♦ Communicating and reproducing (transmission).

Transferring data from one location or operation to another, for use or further
processing, is data transmission. This process continues until information in a usable form
reaches the final user. Sometimes, of course, it is necessary to copy or duplicate output
documents.

Storage
Finally, the results of the processing of data must be retained for future use of reference.
This function is called storage.

Typical Business Processing Application

• The Payroll System


The purpose of the system is to ensure accurate and prompt payment of wages and
salaries to all employees.

Various parts of the system will be as follows:


Inputs : Employee number, attendance data, overtime data, and loan.

Outputs : Pay-slip, and pay ledger.

Stored Data : Employee number, name, designation, department, salary grade,

basic salary, increment date, leave record, and cumulative salary

data.

TECHNO INDIA GROUP Page No-17


BUSINESS SYSTEM Developed By Sangita Pal

Processing Logic
1) Compute salary using basic salary and attendance and leave data. Add
overtime payment to get gross salary.
2) Compute deductions — P.F., income tax, and loan recovery.
3) Compute net salary. Print pay slip, and pay ledger.

Procedures
1) Attendance data for the previous month will be provided by office by the
first of every month.
2) Leave records will be provided by the head of the department in which the
employee works.
3) Input data will be used to update employee record as well as produce various
outputs. The data processing department will process data and distribute the
outputs to the concerned departments.

• Inventory Control System


This system controls the contents and changes made in the inventory of various items in
the organization.

Supporting data files contain details of all items in the inventory and related costs.

♦ Input Vendor invoices; Memos of Goods: Received, Returned, Transferred;


Requests for stock.

♦ Output Listings of all inventory items; Stock on Order; Specially Ordered


Goods; Critical Stock Items; Cost data. Considering the amount of money that
can be tied up in inventory, the management must have reliable information.

TECHNO INDIA GROUP Page No-18


BUSINESS SYSTEM Developed By Sangita Pal

• Financial Accounting System


The classification, recording, and summarization of monetary transactions is defined as
financial accounting.

Although there is some management information generated in financial accounting,


the primary purpose is to paint a financial picture of the organization for investors and
creditors and to satisfy legal requirements.

Monetary transactions, receipts and expenditure of funds, are made available to the
financial accounting module through the database and are maintained in journals.

Periodically, journals are used to create basic financial statements, such as:
♦ Balance sheet
♦ Income statement

The process involved in the preparation of these statements rarely goes beyond simple
calculation and report generation.

Computer System: A Powerful Tool

Computers can process vast quantities of business data at enormous speeds with unfailing
consistency and unimaginable flexibility.
These capabilities of computers open new approaches to problem solving and data
processing.

TECHNO INDIA GROUP Page No-19


BUSINESS SYSTEM Developed By Sangita Pal

Following six characteristics of computers make them indispensable for use in business:

• Speed
Computers speed up data processing by many orders of magnitude compared to manual
system.

• Data Volume
Vast amount of data can be stored and processed very quickly.

• Repetitiveness
The more repetitive the task, the more profitable it is to automate it.

• Complexity
Problems with several interacting variables can be solved quickly and accurately.

• Accurate Output
As high accuracy can be obtained as needed; also, accuracy is not affected by boredom
and fatigue and is not subjective.

• Declining Costs
There has been a steady decline in the cost of per unit of data processed.

Facilities Available in Computerized System

• For Data Capture

Data capture is the identification of new data to be input. It is always best to capture the
data as soon as it originates.
The commonly used input device is a keyboard. Mouse, joy stick, light pen, touch screen,
and trackballs are some of the devices which do not require typing of input information.

TECHNO INDIA GROUP Page No-20


BUSINESS SYSTEM Developed By Sangita Pal

Online Mode
Following devices are used to capture data online
1) Keyboard
2) Light Pen
3) Mouse
4) Scanners
5) Optical Scanners
6) Terminals
7) Smart Cards

Offline Mode
Offline data entry involves devices through which data is first recorded on some media
and then into the computer.
In almost 90% of the applications, data entry is done offline. This saves the precious
computer processing time.

Following devices are used to capture data offline.


1) Key-to-Tape
2) Key-to-Floppy
3) Key-to-Disk

• For Data Validation


The accuracy of input data should be either verified manually or by a computer program.
Some of the techniques used for this purpose are described below:

Using Control Totals


In this technique, the verification program verifies the total. When a business transaction
occurs, it is noted down and calculated at the point of transaction (by a clerk) and the
same transaction data is entered by a computer operator in computer system.

TECHNO INDIA GROUP Page No-21


BUSINESS SYSTEM Developed By Sangita Pal

The data entered by the operator is totaled by the computer. If the two entries do not
match, then it is a clear indication that there is a mistake.
In this manner, only correct data is passed to the machine before processing is done.

Using Built-in Checks by the Computer Program


There should be some control to make sure that no data is entered that is beyond a certain
value.
For example, the salary cheques for a particular organization may not exceed Rs. 20,000.
In this case, if a cheque is made for an amount more than Rs. 20,000, then the
computer will point out an error.

• For Storage and Retrieval


Once the valid data has been entered in the system, it is essential that this data is stored
securely for future use.
Major types of external storage devices used in computerized systems are:
1) Magnetic tapes or cartridge
2) Hard disks
3) Floppy disks
4) Compact disk (CD)

• For Output
There are two basic categories of computer-produced output:
♦ Output for immediate use by people, and

♦ Output that is stored in computer-usable form for later use by the computer.

Output can be in either hardcopy or softcopy form.

TECHNO INDIA GROUP Page No-22


BUSINESS SYSTEM Developed By Sangita Pal

Hardcopy Output Devices


The commonly used hardcopy output devices are:
1) Printers
2) Plotter
3) Microfilm/microfiche

Softcopy Output Devices


1) Cathode Ray Tube (CRT)
2) Voice Output Systems

• For Transmission
Data communication is the most exciting development in data processing today.
Communication, the transfer of information, is the basis of office automation.

Some examples of everyday data communication are:


1) Airline Reservation
Computer is usually located far from the agent; data communication must be used to relay
data from the terminal to the computer and back.

2) Automated Banking
ATMs are widely used in most banks for better customer service. User can make deposits
and withdrawals, check balances, and even pay utility bills through the machines.

3) Point-of-Sale Terminals
These are used in retail stores in place of cash registers. These terminals send records of
sales to a central computer, which maintains accounting and inventory records.

TECHNO INDIA GROUP Page No-23


BUSINESS SYSTEM Developed By Sangita Pal

Concept of Files

Files are documents you can add to your knowledgebase. The type of files you can add is
controlled by the settings of your knowledgebase, but in general you can add graphics,
text documents (Word, Excel, and PowerPoint) or PDF.
The file area is separate to the article knowledgebase, although you can attach the files
from the File area into articles. There are mainly two types of files:

1. Master Files:

A collection of records pertaining to one of the main subjects of an information system


such as customers, employees, products and vendors. Master files contain descriptive
data, such as name and address, as well as summary information, such as amount due and
year-to-date sales.

A database file, often created manually as needed, that contains static records used to
identify items, customers, vendors, bills of material, work centers, etc. as opposed to files
used to track the dynamic status of orders and inventory balances.

A file of data in which is the principal source of information for a job which is updated or
amended as necessary.

(In computer science) it is a computer file that is used as the authority in a given job and
that is relatively permanent

TECHNO INDIA GROUP Page No-24


BUSINESS SYSTEM Developed By Sangita Pal

2. Transaction Files:

A collection of transaction records. The data in transaction files is used to update the
master files, which contain the data about the subjects of the organization customers,
employees, vendors, etc.). Transaction files also serve as audit trails and history for the
organization. Where before they were transferred to offline storage after some period of
time, they are increasingly being kept online for routine analyses.

(In computer science) it is a computer file containing relatively transient data about a
particular data processing task.

File Organization

File organization refers to the relationship of the key of the record to the physical location
of that record in the computer file. The two main objectives of computer-based file
organization are:

1. ease of file creation and maintenance


2. provision for an efficient means of storing and retrieving information

The three file organization methods that are commonly used in business data processing
applications are:

• Sequential
• Relative
• Indexed

The selection of a particular file organization depends upon factors like the type of
application, the method of processing for updating files, and size of file.

TECHNO INDIA GROUP Page No-25


BUSINESS SYSTEM Developed By Sangita Pal

1. Sequential File Organization:

A sequential file is a file, which consists of the same record types that is stored on a
secondary storage device. The physical sequence of records may be based upon sorting
values of one or more data items or fields.

A computer file storage format in which one record follows another. Records can be
accessed sequentially only. It is required with magnetic tape.

Advantages

• Easy to organize, maintain, and understand.

• There is no overhead in address generation locating a particular record requiring

only the specification of the key field.

• Relatively inexpensive I/O media and devices can be used.

• It is the most economical and efficient file organization where the activity ratio

(the ratio of the total number of records in transaction file and the total number

of records in master file) is very high. For this reason, such a file organization is

most suitable for transaction files.

Disadvantages
• It proves to be very inefficient and uneconomical for applications in which the

activity ratio is very low.

• Since an entire sequential file may need to be read to retrieve and update few

records, accumulation of transactions into batches is required.

TECHNO INDIA GROUP Page No-26


BUSINESS SYSTEM Developed By Sangita Pal

• Transactions must be stored and placed in sequence prior to processing.

• Timeliness of data in the file deteriorates while batches are being accumulated.

• Data redundancy is typically high since the same data may be stored in several

files, sequenced on different keys.

2. Relative File Organization:

A relative record file contains records ordered by their relative key, that is, the record
number that represents the record location relative to where the file begins. For example,
the first record in the file has a relative record number of 1, the tenth record has a relative
record number of 10, and so forth. The records can have fixed length or variable length.

The record transmission modes allowed for relative files are sequential, random, or
dynamic. When relative files are read or written sequentially, the sequence is that of the
relative
record number.

3. Indexed File Organization:

An indexed file contains records ordered by a record key. Each record contains a field
that contains the record key. The record key uniquely identifies the record and determines
the sequence in which it is accessed with respect to other records. A record key for a
record might be, for example, an employee number or an invoice number.

An indexed file can also use alternate indexes, that is. Record keys that let you access the
file using a different logical arrangement of the records. For example, you could access
the file through employee department rather than through employee number.

TECHNO INDIA GROUP Page No-27


BUSINESS SYSTEM Developed By Sangita Pal

The record transmission (access) modes allowed for indexed files are sequential, random,
or dynamic. When indexed files are read or written sequentially, the sequence is that of
the key values.

Advantages
• Permits the efficient and economical use of sequential processing techniques

when the activity ratio is high.

• Permits direct access processing of records in a relatively efficient way when the

activity ratio is low.

Disadvantages
• These files must be stored on a direct access storage device. Hence, relatively

expensive hardware and software resources are required.

• Less efficient in the use of storage space than some other alternatives

TECHNO INDIA GROUP Page No-28


BUSINESS SYSTEM Developed By Sangita Pal

Business Data Processing

1. Batch Processing:

Executing a series of non interactive jobs all at one time. The term originated in the days
when users entered programs on punch cards. They would give a batch of these
programmed cards to the system operator, who would feed them into the computer.

Batch jobs can be stored up during working hours and then executed during the evening
or whenever the computer is idle. Batch processing is particularly useful for operations
that require the computer or a peripheral device for an extended period of time. Once a
batch job begins, it continues until it is done or until an error occurs. Note that batch
processing implies that there is no interaction with the user while the program is being
executed.

An example of batch processing is the way that credit card companies process billing.
The customer does not receive a bill for each separate credit card purchase but one
monthly bill for all of that month's purchases. The bill is created through batch
processing, where all of the data are collected and held until the bill is processed as a
batch at the end of the billing cycle.

Batch processing suffers from several disadvantages, which are as follows:

• Reduces timeliness in some cases.

• It makes each job wait in line at each step and often increases its turn-around

time.

• It is difficult to provide the desired priority scheduling

TECHNO INDIA GROUP Page No-29


BUSINESS SYSTEM Developed By Sangita Pal

2. Online Transaction Processing:

It is a class of programs that facilitate and manage transaction-oriented applications,


typically for data entry and retrieval transaction processing.

It is a technique used in a number of industries, including banking, airlines, mail-order,


supermarkets, and manufacturers. Some applications of OLTP include electronic banking,
order processing, employee time clock systems, e-commerce, and eTrading.

Online Transaction Processing has two key benefits: simplicity and efficiency.

l> Reduced paper trails and the faster, more accurate forecasts for revenues and expenses
are both examples of how OLTP makes things simpler for businesses. It also provides a
concrete foundation for a stable organization because of the timely updating.

2> Another simplicity factor is that of allowing consumers the choice of how they want to
pay, making it that much more enticing to make transactions.

Examples of online applications include:

Banking, stock exchanges, stock control, work progress control in plants, and inventory
status

TECHNO INDIA GROUP Page No-30


BUSINESS SYSTEM Developed By Sangita Pal

3. Real Time Processing:

A computer system that functions in such the computer must respond to a way that
information entered at a terminal within a short period of time.

An airline reservation system that must respond with available seats on a flight, or a point
of sale system that must quickly look up stock availability and prices; these are two
examples of real-time systems.

By extension of this concept, real-time in modern usage has come to be used to describe a
very fast response computer system such as one that might be used to control factory
processes.

A real-time system might have a sensor that reads the temperature of a vat of chemicals,
and a method of sending signals to the heater for the vat. As the temperature rises or falls
slightly, the computer switches the heater on and off to keep a consistent temperature in
the vat.

The essential requirements of a real-time processing system include:

• Direct connection (online) between Input/Output devices and the central

processor, and

• Fairly fast response time, allowing two-way communication.

The characteristic of real-time data processing that truly distinguishes it from the more
common batch and online processing systems is the immediacy of its response on receipt
of a message. Thus, all online systems are not necessarily real-time data processing
systems.

TECHNO INDIA GROUP Page No-31


BUSINESS SYSTEM Developed By Sangita Pal

The application areas of real-time systems are:

• Enquiries about customer's account status can be answered in seconds.

• Credit appraisal can be carried out immediately.

• Sales analysis master file can be updated online. This file provides a ready

information to the sales manager regarding sales trends

4. Distributed Data Processing

Distributed processing, broadly speaking, involves a computer system linked by a


communication network where processing is performed by separate computers. Often,
each computer in the system is chosen to handle a specific workload, with the network
supporting the system as a whole. When distributed processing is used, it requires that
databases be located at different sites for efficient functioning. The database is broken up
into logical cooperating parts and situated at a different location. Users can access data
from any location, easily accessing local as well as remote databases. Distributed
Database Systems (DDBS) form the backbone of distributed computing. This form is
most convenient for organizations with many branch offices located over great distances.
Each branch stores data elements relating to its daily operations at its own site. A major
part of processing can be taken care of at the local level. A typical application is in banks
where all the branches have intelligent terminals linked to a big computer at the head
office. Data from the branches is sent to the master, where it is processed.

TECHNO INDIA GROUP Page No-32


BUSINESS SYSTEM Developed By Sangita Pal

CONCEPT OF PROGRAMMING

Unstructured Programming:

Unstructured programming is a programming paradigm where all code is contained in a


single continuous block. This is contrary to structured programming, where programmatic
tasks are split into smaller sections (known as functions or subroutines) that can be called
whenever they are required. Unstructured programming languages have to rely on
execution flow statements such as Goto, used in many languages to jump to a specified
section of code. Unstructured source code is notoriously difficult to read and debug, and
so is discouraged in programming languages that support any kind of structure. However,
structure is not needed in any programming language since program structures can always
be implemented by a combination of conditional statements and Goto statements.

Structured Programming:

Structured programming can be seen as a subset or sub discipline of procedural


programming, one of the major programming paradigms. It is most famous for removing
or reducing reliance on the GOTO statement (also known as "go to"). Historically, several
different structuring techniques or methodologies have been developed for writing
structured programs.
The most common are: The logic of a program is a structure composed of similar sub-
structures in a limited number of ways. This reduces understanding a program to
understanding each structure on its own, and in relation to that containing it, a useful
separation of concerns.

TECHNO INDIA GROUP Page No-33


BUSINESS SYSTEM Developed By Sangita Pal

Procedural Programming:

Procedural programming is sometimes used as a synonym for imperative programming


(specifying the steps the program must take to reach the desired state), but can also refer
to a programming paradigm based upon the concept of the procedure call. Procedures,
also known as routines, subroutines, methods, or functions simply contain a series of
computational steps to be carried out. Any given procedure might be called at any point
during a program's execution, including by other procedures or it. Procedural
programming is often a better choice than simple sequential or unstructured programming
in many situations which involve moderate complexity or which require significant ease
of maintainability.

Possible Benefits: The ability to re-use the same code at different places in the program
without copying it. An easier way to keep track of program flow than a collection of
"GOTO" or "JUMP" statements. The ability to be strongly modular or structured.

Modular Programming:

This is an extension of the procedural approach to reduce the interdependence between


procedures in a program. Data and related procedures are collected in a module. The
module provides some support for hiding data and functions, which manipulate the data.
Data should only be modified by procedures in the same module. The design process
emphasizes data over procedures. Firstly identify the data elements that will be necessary
and then, Wrap them with related procedures in modules if possible.

TECHNO INDIA GROUP Page No-34


BUSINESS SYSTEM Developed By Sangita Pal

PROGRAM DESIGN

Top-Down Approach:

In a top-down approach an overview of the system is first formulated, specifying but not
detailing any first-level subsystems. Each subsystem is then refined in yet greater detail,
sometimes in many additional subsystem levels, until the entire specification is reduced to
base elements. A top-down model is often specified with the assistance of "black boxes"
that make it easier to manipulate. However, black boxes may fail to elucidate elementary
mechanisms or be detailed enough to realistically validate the model.

Bottom-Up Approach:

In a bottom-up approach the individual base elements of the system are first specified in
great detail. These elements are then linked together to form larger subsystems, which
then in turn are linked, sometimes in many levels, until a complete top-level system is
formed. This strategy often resembles a "seed" model, whereby the beginnings are small,
but eventually grow in complexity and completeness. However, "organic strategies", may
result in a tangle of elements and subsystems, developed in isolation, and subject to local
optimization as opposed to meeting a global purpose.

Program Documentation

Program documentation includes hard-copy or electronic manuals that enable users,


program developers, and operators to interact successful with a program. User
documentation normally consists of a user's manual. This manual may provide
instructions for running the program. A description of software commands several useful
examples of applications, and troubleshooting guide to help with difficulties.

TECHNO INDIA GROUP Page No-35


BUSINESS SYSTEM Developed By Sangita Pal

VISUAL FOXPRO – AN INTRODUCTION

Introduction
Visual FoxPro is a Relational Database Management System (RDBMS), which allows
you to work with several logically related tables of data simultaneously. A Table in a
database contains a number of Rows and Columns. One row in the table is equivalent to
one record and one column is equivalent to one field.

A Brief History of Visual FoxPro


In 1984, Fox Software introduced FoxBase to compete with the desktop database product
it was modeled after, Ashton-Tate's dBASE II. At that time FoxBase was little more than
a programming language and a data-handling engine. FoxPro acquired a GUI in 1989,
and in 1991 took off solidly in its own innovative territory with the release of FoxPro 2.0.
That product contained a fully integrated version of SQL, unequalled performance
capabilities, open architecture in its development tools, and several design surfaces that
actually generated code and applications from a user's onscreen manipulations.

FoxPro evolved into Visual FoxPro in 1995. It retained its procedural capabilities,
primarily to maintain backward-compatibility, but added tremendously to its professional
stature by becoming a fully realized object-oriented language as well. And, of course,
there were still more development tools to work with! VFP is now in its third major
release, version 6. Its outlook is very much expanded to encompass interaction with other
major desktop and client/server products, and to build Web-based applications.

Objectives
After going through this lesson, you would be able to
• start Visual FoxPro menus
• use shortcut keys
• use Visual FoxPro menus.
• explain the concept of DBMS

TECHNO INDIA GROUP Page No-36


BUSINESS SYSTEM Developed By Sangita Pal

Concept of Database Management System (DBMS)

Before you understand the concept of Database Management System. (DBMS), it is


necessary that you understand few basic terms related to DBMS. Let us begin with data.
Anything can be data, e.g., a number, name of a person or place, address, etc. When a
data is meaningful, it is called Information and a Database is an organized collection of
related information. You can use database for– retrieving desired information

– taking meaningful decision


– reorganizing information
– processing information

Database Management System (DBMS) is a generalized software package used to build


and manage the database, i.e., add, modify (edit), update, delete and sort (arrange in a
particular order) information in the database. DBMS also helps to retrieve the desired
information in the required format from the database. Visual FoxPro is a leading database
Management System. It is a member of Microsoft Visual Studio. Visual FoxPro is one of
the Relational Database Management System (RDBMS). It is windows based Graphical
User Interface (GUI) RDBMS. The database is a broader concept in Visual FoxPro in
which the information is stored in related tables. The table is equivalent to database of the
earlier version of FoxPro.

A database is a collection of various records comprising rows and columns. One row is
one record and one column is one field. A record is collection of logically related fields
and a field is one-column information. In Visual FoxPro, there can be more than one table
storing different stream of information. A table in a database contains a number of Rows
and Columns. One row in the table is equivalent to one record and one column is
equivalent to one field.

TECHNO INDIA GROUP Page No-37


BUSINESS SYSTEM Developed By Sangita Pal

Starting Visual FoxPro

Assuming that you have Visual FoxPro 6 (VFP) installed on your machine, how do you
start it? When VFP installs, it creates a new Windows group called Microsoft Visual
FoxPro and/or installs Visual FoxPro in the Start menu. In Windows NT, this group
appears in the Project Manager. Double-clicking the group icon opens the group window,
revealing an icon named Microsoft Visual FoxPro 6. This icon represents the main
program. In Windows 95, VFP installs a group (now called a folder) in the Programs
menu of the Start button. By default, the program folder gets the name Microsoft Visual
FoxPro. Clicking this option opens another menu level that shows the available programs
installed with Visual FoxPro. These programs correspond to the programs shown in the
Visual FoxPro group window of the Project Manager.

Here we have discussed 6.0 version of Visual FoxPro In order to start with Visual
FoxPro; you must ensure that Visual FoxPro system is already installed on your
computer. To invoke Visual FoxPro, click on start button, then all programs, then
Microsoft Visual Studio 6.0 and the Visual FoxPro 6.0.

The Visual FoxPro window will appear on your screen as shown below.
There are two windows

1. Command Window
2. View Window

TECHNO INDIA GROUP Page No-38


BUSINESS SYSTEM Developed By Sangita Pal

Using Visual FoxPro Menus


The Visual FoxPro Menu system can be classified into the following components as:
• Menu Bar
• Menu Pad (Item)
• Menus (Pull Down Menu)
• Menu Options
• Toolbar

1. Menu Bar
A Menu Bar is located at the top of the screen and displays all the available titles for
menu. The content of the menu bar changes when you move from one title to another title
of the menu bar.

TECHNO INDIA GROUP Page No-39


BUSINESS SYSTEM Developed By Sangita Pal

2. Menu Pads (Items)


The titles displayed on the menu bar are called Menu Pads (Items). You can use either the
mouse or the keyboard to display the menu associated with each menu pad. Using the
mouse, click on the title of the menu you wish to use. To access the menu bar from
keyboard, press <ALT> or <F10> key and then type the underlined letter for the menu
you wish to use. For example <ALT>+F for invoking File Menu. You can also use the
Left and Right arrow keys to move from one menu pad to another menu pad, and press
<RETURN> key. You will also find that some of the menu pads appear dimmed and
cannot be highlighted or selected. These menu pads are disabled. You cannot display the
menu if the menu pad is disabled.

3. Menus
When you choose a menu pad from the menu bar by clicking the menu pad, Visual
FoxPro displays a pull-down menu. A Menu is a list of related options displayed in the
pull-down menu. When you choose an option from a menu, Visual FoxPro executes it.
Choosing an option means activating a highlighted option by clicking with mouse or
pressing the <Spacebar> key or <Return> key.

4. Menu Options
When you choose a menu pad from the menu bar, Visual FoxPro displays a pull-down
menu. A pull-down menu contains options. The options on each menu are logically
related to menu pad. To choose a desired menu option you want, use one of the following
methods:

• Move to the menu pad and click. The pull-down menu appears. Click on the
desired option you want.
• Press <Alt> key or <F10> key and then press the underlined letter (hot key) in the
menu pad name. Type the underlined key for the menu option you want.

TECHNO INDIA GROUP Page No-40


BUSINESS SYSTEM Developed By Sangita Pal

• Use the Left and Right Arrow keys to the menu pad you want to use and then
press <Return> key. Use the Up and Down arrow keys to select the desired option
and then press the <Return> key or <Spacebar> key.

You will find that some of the menu options have an ellipsis (…) after the option. This
indicates that the option will further open a dialog box. A dialog box appears to request
the additional information.

The File Menu Options: The File menu pop-up list contains options related to accessing
files (creating new files, opening existing ones, closing, saving, and printing). Table 1
describes these options.

Table 1: File Menu Options

Menu Option Description

New Opens the New dialog box. The options in this dialog box enable you
to create new projects, databases, tables, queries, connections, views,
remote views, forms, reports, labels, programs, classes, text files, and
menus.

Open Opens the Open dialog box, which opens any file type listed under
New.

Close Closes the active window. If you press Shift and open the File menu,
this option becomes Close All, which closes all open windows.

Save Saves the file in the active window with its current name. For a new
file that has no name, the option prompts the user for a filename.

Save As Prompts the user for a new filename before saving the file.

Save As Class Saves the current form or selected controls as a class definition
(active only from within the Form Designer).

TECHNO INDIA GROUP Page No-41


BUSINESS SYSTEM Developed By Sangita Pal

Revert Cancels changes made in the current file during the current editing
session.

Import Imports a Visual FoxPro file or a file formatted by another


application. You can also use this option to start the Import Wizard.

Export Exports a Visual FoxPro file in another application's file format.

Page Setup Changes the page layout and printer settings for reports.

Page Preview Displays pages in a window as they will appear when printed.

Print Prints the contents of the current window, a file, or Visual FoxPro's
Clipboard.

Send Enables you to send email.

<project files if any> Provides quick access to reopen any of the last four opened projects.

Exit Exits Visual FoxPro. Choosing this option is the same as typing QUIT
in the Command window.

The Edit Menu Options The options in the Edit menu provide functions that are used
for editing programs, forms, and reports. This menu also contains options that create
object linking and embedding (OLE) objects. Table 2 lists the options that appear at
various times in the Edit menu pad.

Table 2: Edit Menu Options

Menu Option Description

Undo Reverses an unlimited number of changes made in the current edit


session. Changes made before the last save, even if made during
the same session, are not reversible.

TECHNO INDIA GROUP Page No-42


BUSINESS SYSTEM Developed By Sangita Pal

Redo Performs a reversed change again.

Cut Removes the selected text or object from current document and
places it on the Clipboard.

Copy Makes a copy of the selected text or object and places it on the
Clipboard.

Paste Copies the current contents of the Clipboard to the current


insertion point.

Paste Special Used to insert OLE objects from other applications into a general
field. You can embed objects or merely link them. Visual FoxPro
stores a copy of embedded objects in the current object. When an
object is linked, FoxPro stores a path and name reference to the
original object only.

Clear Removes selected text without copying it to the Clipboard.

Select All Selects all objects in the current window. This option is used often
in form and report design to move or format all objects at the same
time.

Find Displays the Find dialog box, which is used to locate text strings in
files. Find options include the capability to ignore case, wrap
around lines, match entire words, and search forward or backward.

Find Again Repeats the last Find starting at the current insertion point position
rather than the beginning of the document.

Replace Displays the Replace dialog box, which is used to locate and
replace text strings in files.

Used primarily during debugging to go to a specific line number in


Go to Line a program file. This option cannot be used when word wrap is on.
(Of course, you don't have word wrap on when you edit your

TECHNO INDIA GROUP Page No-43


BUSINESS SYSTEM Developed By Sangita Pal

FoxPro programs-right?)

Similar to Paste Special, except that it does not assume that the
Insert Object object already exists and is stored on the Clipboard. The option
embeds objects in general type fields. When chosen, Insert Object
opens the other application without exiting Visual FoxPro. After
creating the object in the other application, Insert Object returns to
Visual FoxPro and inserts the linked or embedded object.

Object Provides options for editing a selected OLE object.

Links Opens linked files (OLE) and enables you to edit the link.

Properties Displays the Edit Properties dialog box, which enables you to
affect the behavior, appearance, and save options of the edit
windows.

Several options from Table 2 -Paste Special, Insert Object, Object, and Links-apply only
to general fields and OLE. The rest of the options apply to editing programs and fields.

The Edit Properties dialog box, opened by choosing the last option in the Edit menu,
gives you control over the editor's many properties. The behavior properties, for example,
turn on and off drag-and-drop editing, word wrap, and automatic indent. (Unless you are
using Visual FoxPro editor as a word processor, I do not recommend using word wrap.)

You can also specify the following:

• Alignment of text (usually left for programs)


• Number of spaces in a tab
• Editor font
• Use of syntax coloring (a helpful enhancement)
• Display of the column and row position of the insertion point

TECHNO INDIA GROUP Page No-44


BUSINESS SYSTEM Developed By Sangita Pal

Finally, you can have VFP make a backup copy of the file when you edit it, compile the
file when it is saved, save line feeds, and create an end-of-file marker.

The View Menu Options The View menu displays options that are appropriate for
viewing the current table, if one is open. If you are not currently viewing a file, the menu
displays a single option (Toolbar) that opens the Toolbar dialog box, which lists the
available toolbars used by Visual FoxPro 6. On the other hand, if you already are
browsing a table or editing a form, menu, or report, additional options appear as described
in Table 3.

Table 3: View Menu Options

Menu Option Description

Edit Changes to an Edit layout style for viewing and changing records.
The option displays fields vertically, and a horizontal line separates
records (if grid lines are active).

Browse Changes to a Browse layout style for viewing and changing records.
The option displays fields horizontally; rows represent records and
columns represent fields.

Append Mode Appends a blank record to the end of the table and moves the record
pointer to the first field in it.

Design Displays the Form, Label, or Report Designer.

Tab Order Enables you to set the tab order in forms.

Preview Shows a preview of labels or reports onscreen.

Data Environment Defines tables and relations used in a form, form set, or report.

Properties Displays the Properties dialog box for forms and controls.

Code Opens the code windows when you are editing object methods.

TECHNO INDIA GROUP Page No-45


BUSINESS SYSTEM Developed By Sangita Pal

Form Controls Opens the Form Controls toolbar while you are in the Form
Toolbar Designer.

Report Controls Displays the Report Controls toolbar, which enables you to add
Toolbar controls to a report.

Layout Toolbar Opens the Layout toolbar, which helps you align controls.

Color Palette Opens the Color Palette toolbar, which enables you to select
Toolbar foreground and background colors for a control.

Report Preview Provides buttons that move between pages of the preview, change
Toolbar the zoom factor, print the report, and exit preview mode.

Database Designer Opens the Database Designer, which maintains tables, views, and
relationships stored in a database.

Table Designer Opens the Table Designer, which enables you to make structure
modifications to associated and free tables and to their indexes.

Grid Lines Toggles the display of grid lines on and off.

Show Position Displays the position, height, and width of the selected object or
form in the status bar.

General Options Adds code in a menu when you are using the Menu Designer.

Menu Options Adds code to specific menu options.

Toolbars Displays a dialog box that lists every toolbar used by FoxPro,
enabling you to customize the buttons in toolbars and to create your
own.

The Format Menu Options The Format menu normally consists of options that control
font characteristics, text indentation, and spacing. Additional options become available,
however, when you are using the various Designers, and are described in Table 4.

TECHNO INDIA GROUP Page No-46


BUSINESS SYSTEM Developed By Sangita Pal

Table 4: Format Menu Options

Menu Option Description

Font Selects a font and its characteristics.

Enlarge Font Enlarges the font used in the current window.

Reduce Font Reduces the font size used in the current window.

Single Space Single-spaces the text in the current window.

1 1/2 Space Uses 1 1/2-line spacing for the text in the current window.

Double Space Double-spaces the text in the current window.

Indent Indents the current or selected lines in the current window.

Unindent Removes the indent of the current or selected lines in the current
window.

Comment Comments out the selected lines.

Uncomment Removes comments from the selected lines.

Align Opens options that align selected objects.

Size Opens options that size selected objects.

Horizontal Spacing Provides options that adjust horizontal spacing between selected
objects.

Vertical Spacing Provides options that adjust vertical spacing between selected
objects.

Bring to Front Moves the selected object to the top of the objects in a form.

Send to Back Moves the selected object to the back of the objects in a form.

Group Associates a selection of objects in reports and enables you to work


with them as a group.

Ungroup Breaks a group definition into individual objects again.

TECHNO INDIA GROUP Page No-47


BUSINESS SYSTEM Developed By Sangita Pal

Snap to Grid When you are moving objects, repositions the top-left corner to the
nearest grid intersection when the mouse button is released.

Set Grid Scale Determines how far apart the vertical and horizontal grids are.

Text Alignment Aligns text in the selected object.

Fill Defines a fill pattern for shapes.

Pen Defines a pen thickness and style for shapes.

Mode Defines whether the background of an object is opaque or


transparent.

The Tools Menu Options The Tools menu provides a variety of programmer tools,
ranging from wizards to the debugger. Table 5 defines the options in the Tools menu.

Table 5: Tools Menu Options

Menu Option Description

Wizards Lists and provides access to Visual FoxPro's wizards.

Spelling Primarily spell-checks text fields and memos.

Macros Defines and maintains keyboard macros.

Class Browser Examines the contents of any class to view its properties and
methods or even the actual code used to create the object.

Beautify Reformats program files to add indenting and capitalization.

Debugger Opens the Debugger window. This improved replacement for


the Debug and Trace window adds windows for watch
variables, locals, call stack, and the capability to track events
and analyze coverage during testing.

Options Provides access to Visual FoxPro configuration options.

TECHNO INDIA GROUP Page No-48


BUSINESS SYSTEM Developed By Sangita Pal

The Macro dialog box enables you to create, edit, and view macro definitions. A macro
definition consists of a series of Visual FoxPro commands that you can store and execute
with a single keystroke. Previously FoxPro provided eight default macro definitions,
which are assigned to function keys F2 through F9. Pressing F5, for example, executes
the command DISPLAY STRUCTURE, which lists the structure of the current table. Table 6
shows the definitions of these default macros.

Table 6: Default Macro Definitions for Function Keys

Key Command Description

F2 SET Opens the View window.

F3 LIST Lists records from the current table; opens the GETFILE
window if no table is being used.

F4 DIR Lists all tables in the current directory.

F5 DISPLAY STRUCTURE Shows the field definitions of the current table; opens the

STRUCTURE GETFILE window if no database is being used.

F6 DISPLAY STATUS Shows the table opens in each area. If an index is also
open, F6 displays its expression. The key also shows the
settings of SET commands and other system information.

F7 DISPLAY MEMORY Displays the values stored in all memory variables,


including system variables. F7 also shows the definitions
of all menus, pads, pop-up lists, and windows.

F8 DISPLAY Displays the current record; opens the GETFILE window if


no table is being used.

F9 Enters append mode for the current table. Opens the


GETFILE window if no database is being used.

TECHNO INDIA GROUP Page No-49


BUSINESS SYSTEM Developed By Sangita Pal

In addition to these eight macros, you can define your own. In fact, because you can use a
variety of key combinations to name macros, you can define more than 250 macros at one
time.

The last option in the Tools menu is Options, which displays a multiple-page form that
provides controls to customize the way you work with Visual FoxPro. VFP divides these
controls into 12 distinct groups: Controls, Data, Debug, Field Mapping, File Locations,
Forms, General, Projects, Regional, Remote Data, Syntax Coloring, and View. These
groups are covered in more detail in the section "Setting Configuration Options" later in
this chapter.

The Program Menu Options: The Program menu consists of six options that are related
to compiling and running a program. Table 7 describes the Program options.

Table 7: Program Menu Options

Menu Option Description

Do Runs a program selected from a dialog box.

Cancel Cancels the current program.

Resume Resumes the current program from a suspended state.

Suspend Stops the current program from executing but does not remove it from
memory.

Compile Translates a source file into object code.

Run Runs the current program. (The option appears in the menu as Do,
followed by the name of the PRG.)

TECHNO INDIA GROUP Page No-50


BUSINESS SYSTEM Developed By Sangita Pal

The Do command opens a dialog box that enables you to select the program that you want
to run. (You can also execute a program from the Command window; enter DO
immediately followed by the name of the program that you want to run.) You do not have
to compile a program before running it; you can run a PRG directly. VFP can compile the
program automatically before running it.

Choose Program, Do, and select the program from the Do dialog box, which is similar to
the Open dialog box. The Do option differs from the Run option (which appears in the
menu as Do, followed by the name of the PRG), which executes the program in the
current window.

VFP enables the Cancel option only when you are executing a program. To access this
option, you must suspend the program or be stepping through it in the Trace window.

Visual FoxPro enables Resume only while an executing program is suspended. The
option resumes a suspended program to normal execution mode.

To suspend a program, you first need to interrupt it. You can do this while you are using
the Trace window to step through the program. You can interrupt a program by inserting
breakpoints into the code, using the Trace window, or setting break conditions on
variables or expressions.

The Compile option opens a window similar to the Open dialog box, enabling you to
select a source file. The option takes the selected program source file (PRG) and compiles
it. Click the More>> button to display several additional options related to encryption and
debugging, as well as to create an error file (ERR), if desired.

The Window Menu Options: The Window menu contains options that manage open
windows onscreen. The menu provides options that enable you to Arrange All, Hide,
Clear, and Cycle through windows. In addition, the menu enables you to bring to the front
any window that is currently open. Table 8 lists the Window options.

TECHNO INDIA GROUP Page No-51


BUSINESS SYSTEM Developed By Sangita Pal

Table 8: Window Menu Options

Menu Option Description

Arrange All Arranges open windows as non-overlapping tiles.

Hide Hides the active window but does not remove it from memory.

Show All Displays all defined windows.

Clear Clears text from the application workspace or current output window.

Cycle Moves from one open window to the next, making the next window the
active one.

Menu Option Description

Command Window Makes the Command window active and brings it to the top, opening it
if necessary.

Data Session Makes the Data Session window active and brings it to the top, opening
it if necessary. This window serves as a valuable tool for monitoring
which tables are open in each of the 32,767 work areas.

<Window List> Displays the first nine defined windows. If more than nine windows
have been defined, a final option-More Windows-appears. To change
focus to any window, simply click its name.

The Arrange All option resizes open windows to create non-overlapping tiles. Arrange
All will not resize a maximized window. With two open windows, it splits the screen in
half vertically and puts the active window on the left side. With three open windows, it
also splits the screen in half vertically, putting the active window on the left side. The
option then splits the right half horizontally, however, to display the other two open
windows. If you have four open windows, each window receives one-quarter of the
screen; the active window is placed in the upper-left corner. For more windows, you'll
have to experiment.

TECHNO INDIA GROUP Page No-52


BUSINESS SYSTEM Developed By Sangita Pal

The Hide option removes the active window from the screen. You cannot redisplay a
system window (such as an edit window for a program) without reissuing the command
that created it. If you hide a user-defined window, however, that window remains in
memory; you can redisplay it with the SHOW WINDOW command. If you hide the current
output window, it continues to receive output even while it is hidden, which means that
you cannot see it. Upon redisplaying the window, you again see anything that has been
written to it.

The Clear option erases text from the current screen or active window. Notice that when
you use the SHOW WINDOW command after hiding a window, that window does not
automatically become the active window; its status depends on whether it was the active
window when it was hidden and whether you activated another window in the meantime.
(To ensure that a window is active, use the ACTIVATE WINDOW command.) Therefore, be
careful about what you clear.

The Help Menu Options: Help is the final menu pad of the System menu. Table 9 lists
the options available in this menu. The first two options present different ways to access
the help file to get information on commands, functions, or features. The third option lists
support options that are available from Microsoft. The last option opens the typical
copyright screen for the product; it adds additional functionality by providing system
information and allowing the user to run other applications from within FoxPro.

TECHNO INDIA GROUP Page No-53


BUSINESS SYSTEM Developed By Sangita Pal

Table 9: Help Menu Options

Menu Option Description

Contents Displays help information via an outline format.

Documentation Opens the FoxPro online documentation.

Sample Applications Describes the sample applications provided with Visual FoxPro.

Microsoft on the Opens a second menu with options to use your Web browser to go
Web to a variety of Visual FoxPro pages on the Web, the Microsoft
home page, and several other locations.

Technical Support Provides a list of available resources from Microsoft that offer
additional help. The list includes a section that answers common
questions.

About Microsoft Displays the copyright screen for the product, along with FoxPro
Visual whom it is licensed to, version date, resource filename, default
directory, and product ID. Additional features include the capability
to list system information and to run other programs.

The About Microsoft Visual FoxPro option displays an initial screen that contains the
standard copyright and license information. The screen includes a special bonus: the
System Info button. Click this button to display information about your system.

TECHNO INDIA GROUP Page No-54


BUSINESS SYSTEM Developed By Sangita Pal

Shortcut Keys for Menu Options


Visual FoxPro provides various shortcut Keys to choose the menu options. Some of them
are listed below.

Key(s) Action
Ctrl+A To select all the current objects.
Ctrl+C To copy the current selection to the clipboard.
Ctrl+D To start a Visual FoxPro Program
Ctrl+G To move the cursor to the designated line in a text or in the command
window.
Ctrl+M To resume a program.
Ctrl+P To Print.
Ctrl+R To redo.
Ctrl+S To save the file.
Ctrl+V To paste the content of the clipboard at the current cursor position.
Ctrl+W To leave the current operation and to save any modification.
Ctrl+X To cut the selected object from its current location and to place it on the
clipboard.
Ctrl+Y To append new record.
Ctrl+Z To undo.
Ctrl+F1 To activate the next window open within Visual FoxPro.
Ctrl+F2 To display the command window.
Ctrl+F4 To close the current window.
Ctrl+F5 To restore the current window to its original size.
Ctrl+F7 To move the current window with the arrow key.
Ctrl+F8 To increase/decrease the size of the current window.
Ctrl+F9 To minimize the current window to an icon.
Ctrl+F10 To maximize the current window.
Esc To exit current editing without saving the modification.

TECHNO INDIA GROUP Page No-55


BUSINESS SYSTEM Developed By Sangita Pal

F1 To activate on-line help.


F2 To open the view window.
F3 To list the content of the current table.
F4 To list the files in the current directory.
F5 To display the structure of the current table.
F6 To display the status.
F7 To display the current memory variables.
F8 To display the field names and the current record of the current table.
F9 To open the Browse window in append mode.

Toolbar
The Toolbar appears below the menu bar and displays the icon. To access the toolbar
using the mouse, click on the icon you want to use.

Buttons on the Standard Toolbar

Button Name Description

New Opens the New File dialog box to create a new file.

Open Opens the Open File dialog box to open an existing file.

Save Saves changes made to the current file. By default, the button uses
the file's original filename, except for a new file that has no name,
in which case it prompts for a filename.

Print Prints the active file, Command window contents, or Clipboard


contents.

Print Preview Uses a preview window to show what Print would output.

Spelling Activates the spell checker.

TECHNO INDIA GROUP Page No-56


BUSINESS SYSTEM Developed By Sangita Pal

Cut Cuts the current selected text or object and places it on the
Clipboard.

Copy Copies the current selected text or object and places it on the
Clipboard.

Paste Copies the current contents of the Clipboard and pastes it at the
current insertion point location.

Undo Undoes the last action or command, with some limitations. The
Undo button cannot undo a PACK command, for example.

Redo Repeats the last command or action.

Run Appears enabled if Visual FoxPro has an executable file open, such
as a screen or program.

Modify Form Switches the currently executing form back into designer mode.

Database Lists the names of all open databases in a drop-down list. The
current database appears in the text box. You can switch to a
different database by selecting it from the list.

Command Window Opens or pops the Command window back into view and makes it
the active window.

View Window Opens or pops the View window back into view and makes it the
active window.

Form Wizard Launches the Form Wizard.

Report Wizard Launches the Report Wizard.

AutoForm Wizard Creates a form from the current table.

AutoReport Wizard Creates a report from the current table.

Help Displays Visual FoxPro's Help Contents screen.

TECHNO INDIA GROUP Page No-57


BUSINESS SYSTEM Developed By Sangita Pal

The Status Bar

The status bar appears at the bottom of Visual FoxPro's main screen if SET STATUS is ON.
The status bar itself has two main areas: the message area on the left and indicator boxes
on the right.

The message area is blank when no table is open in the current work area. When a table is
open, the message area displays the following:
• The table's name
• The table's database name (enclosed in parentheses, if appropriate)
• The current record number
• The total number of records in the table
The Designers use this area to display the position and size of objects.

Finally, the message area displays the current sharable status of the file or current record
using one of the following designations:
• Exclusive
• Record Unlocked
• Record Locked
• File Locked

Visual FoxPro also uses this portion of the status bar to display system messages that
concern issues such as its progress during reindexing. Forms also use this area to display
text messages associated with fields and controls, as well as position and size information
while you are in the Designers.
The right end of the status bar contains either three or four indicator boxes. The first box
on the left indicates the status of the Insert key. This box is blank when VFP's editor is in
Insert mode; otherwise, the letters OVR appear, indicating overwrite mode. The next box
displays NUM when the Num Lock key is on. The third box indicates the status of the
Caps

TECHNO INDIA GROUP Page No-58


BUSINESS SYSTEM Developed By Sangita Pal

Zooming Windows

As mentioned earlier in this chapter, the title bar of a window has several buttons on the
right side. The button with the lower horizontal line minimizes the window, representing
it with an icon or docking it in the taskbar. (For windows within FoxPro, however, this
button docks the icon on FoxPro's main screen, not the Windows desktop.) The button
with the single window image maximizes the window. For a maximized window, the
Restore button replaces the Maximize button; it has the image of two cascaded windows.

If you do not have a mouse, or if you just prefer not to take your hands off of the
keyboard long enough to pick up the mouse, you can zoom the window by using shortcut
keys. You can open the Windows 95 Window menu by pressing Alt+-. This shortcut key
displays the options and their shortcut keys. Table 10 lists the shortcut keys, which work
consistently across all Windows applications.

Table 10: Commands in the Window Menu with Their Shortcut Keys

Command Shortcut Key Description

Restore Ctrl+F5 Returns the window to its original size.

Move Ctrl+F7 Enables you to move the window with the


arrow keys.

Size Ctrl+F8 Enables you to size the window with the


arrow keys.

Minimize Ctrl+F9 Minimizes the window and displays it as an


icon.

Maximize Ctrl+F10 Maximizes the window.

Close Ctrl+F4 Closes the window.

Next Window Ctrl+F6 Activates the next window.

TECHNO INDIA GROUP Page No-59


BUSINESS SYSTEM Developed By Sangita Pal

File Types The different types of files possible in Visual FoxPro are shown below.

Wizards: Wizards are interactive programs that help the user to create a new file (table,
report or query) by answering a series of questions. Different types of wizards available
in Visual FoxPro are shown in the following screen.

TECHNO INDIA GROUP Page No-60


BUSINESS SYSTEM Developed By Sangita Pal

Exiting Visual Foxpro


You can exit Visual FoxPro by using any one of the following methods:
• Type quit in the command window and press <Return> key.
• Open the File menu and choose the Exit option.
• Click mouse on the Control Menu Box from the Title bar of the main Visual
FoxPro window.
• Press <Alt+F4> key.

TECHNO INDIA GROUP Page No-61


BUSINESS SYSTEM Developed By Sangita Pal

INTRODUCTION TO PROGRAMMING

Definition
In order to solve a computation problem, its solution must be specified in terms of a
sequence of computational steps, each of which may be effectively performed by a human
agent or by a digital computer.
Systematic notations for the specification of such sequences of computation steps are
referred to as programming languages.

A sequence of statements (instructions) in order to carry out a defined task is referred to


as program.

The task of developing programs for the solution of computation problems is referred to
as programming.

A person engaged in the activity of programming is referred to as a programmer.

Steps in Program Development


The following basic steps are involved in writing computer programs:
• Problem identification
• Task analysis and data analysis
• Output identification
• Designing the solution
• Data validation
• Implementation and debugging
• Final documentation and maintenance

Ideally, these steps are generally performed in sequence. But in practice, the development
goes through a spiral process.

TECHNO INDIA GROUP Page No-62


BUSINESS SYSTEM Developed By Sangita Pal

Characteristics of a Good Program


A "good" program has the characteristics mentioned below:

1. Accuracy: The program must do what it is supposed to do, and meet the criteria laid
down in its specification.

2. Reliability: The program must ALWAYS do what it is supposed to do, and never
crash.

3. Efficiency: The program must use the available store space and resources in such a
way that the system's speed is not wasted.

4. Robustness: The program should cope with invalid data without stopping, with no
indication as to the cause and without creating errors.

5. Usability: The program must be easy to use and well documented.

6. Maintainability: The program must be easy to amend, having good structuring and
documentation.

7. Readability: The code in the program must be well laid out and explained with
comments.

Programming Language

A programming language is a machine-readable artificial language designed to express


computations that can be performed by a machine, particularly a computer. Programming
languages can be used to create programs that specify the behavior of a machine, to
express algorithms precisely, or as a mode of human communication.

TECHNO INDIA GROUP Page No-63


BUSINESS SYSTEM Developed By Sangita Pal

The term programming language usually refers to high-level languages, such as BASIC,
C, C++, COBOL, FORTRAN, and Pascal. Each language has a unique set of keywords
(words that it understands) and a special syntax for organizing program instructions.
High-level programming languages, while simple compared to human languages, are
more complex than the languages the computer actually understands, called machine
languages. Each different type of CPU has its own unique machine language.

Lying between machine languages and high-level languages are languages called
assembly languages. Assembly languages are similar to machine languages, but they are
much easier to program in because they allow a programmer to substitute names for
numbers. Machine languages consist of numbers only.

Lying above high-level languages are languages called fourth-generation languages


(usually abbreviated 4GL). 4GLs are far removed from machine languages and represent
the class of computer languages closest to human languages.

TECHNO INDIA GROUP Page No-64


BUSINESS SYSTEM Developed By Sangita Pal

Algorithm

In mathematics, computing, linguistics, and related subjects, an algorithm is a finite


sequence of instructions, an explicit, step-by-step procedure for solving a problem, often
used for calculation and data processing. It is formally a type of effective method in
which a list of well-defined instructions for completing a task will when given an initial
state; proceed through a well-defined series of successive states, eventually terminating in
an end-state.

Flowcharts are often used to graphically represent algorithms.

Characteristics of Algorithms

• Finiteness: An algorithm should always terminate after a finite number of steps.


• Definiteness: Each step of the algorithm is precisely defined. This means that the
rules should be consistent and unambiguous.
• Completeness: The rules must be complete so that the algorithm can solve all
problems of a particular type for which it is designed.
• Input-Output: An algorithm has certain inputs and certain outputs that are in
specific relation to the inputs.

Effectiveness and Efficiency of Algorithms

• Speed of solution (economy of operations)


• Stability of solution
• Accuracy of the result

The skilful choice of the algorithm for solving a problem, the rational sequence of
operations, and the methods of recording intermediate results assist in speeding up the
solution and reducing errors and time.

TECHNO INDIA GROUP Page No-65


BUSINESS SYSTEM Developed By Sangita Pal

Flowchart

A flowchart is a common type of chart that represents an algorithm or process, showing


the steps as boxes of various kinds, and their order by connecting these with arrows.
Flowcharts are used in analyzing, designing, documenting or managing a process or
program in various fields.

A simple flowchart representing a process for dealing with a non-functioning lamp.

Report Generation
Commercial outputs need formatted output. These formatted outputs are known as
reports. A formatted report may have the following:
• Report heading
• Page heading
• Page numbering
• Footers
• Some remarks
• Date, month, and year of printing

TECHNO INDIA GROUP Page No-66


BUSINESS SYSTEM Developed By Sangita Pal

Commercial outputs may also extend over multiple pages. In that case, one will have to
keep a provision in his program so that certain details get printed on every page.

Example: One may have to print page heading on every page.


Report may be of:
• Single page
• Multiple pages

Multiple page reports generally consist of following parts:


• Report heading: It represents the title of the report and appears, only on the first

page of the report.

• Report subheading: It is printed as and when required on each page

• Page heading: It is printed on the top of each page.

• Page footer: It is printed at the bottom of each page. It generally totals number of

records on the page and sum of the numeric data.

• Report detail: This constitutes the main body of a report. The output details or the

information of the main consequence are listed in this group.

Reports with Control Break

The most important objective of a program is reporting. We need summarized


information for decision making. For presenting the summarized information one can use
the concept of control break. In control break report, one needs to group information
based on some common criterion.

TECHNO INDIA GROUP Page No-67


BUSINESS SYSTEM Developed By Sangita Pal

Example:

Indian Office Automation Products


New Delhi
Date Regionwise Sales Report Page N o
Salesman Region of Product Sales
Name Sales
Rishabha Mumbai Fax 60,000
Sun/a Mumbai Telex 50,000
Sale of Mumbai Region: 11 0,000
Atul Delhi PC 45,000
Roghav Delhi Telex 50,000
Sale of Delhi Regioni 95,000

In this report control break is on the region.

Analysis of report shows the following points:

• Records of a particular region are grouped together and printed at one place.

• When the control break occurs, certain procedures are followed, such as looking at

the total sales of that region.

• It may be necessary that performance of each region is printed on each page, that

is, when the control break occurs the report is printed on a fresh page.

• At the end of report it may be necessary to calculate and print the grand total.

TECHNO INDIA GROUP Page No-68


BUSINESS SYSTEM Developed By Sangita Pal

How to Create a New Program

There are two ways to create a new program:


• Using Menu Mode:
Select FILE »NEW»PROGRAM and then click on NEW FILE push button.

• Using Command Mode:


The command to create a new program is MODIFY COMMAND.

Syntax:
MODIFY COMMAND <Program Filename>

Example:
MODIFY COMMAND NEW

Saving a Program
• Select FILE » SAVE AS
or
• Press Ctrl+W key combination

Extension of a Program file is .PRG

Executing a Program
A Visual FoxPro program is executed by using the command DO.

Syntax:
Do <Program Filename>

Example:
Do NEW

TECHNO INDIA GROUP Page No-69


BUSINESS SYSTEM Developed By Sangita Pal

To stop a program

To stop a program in between, press ESC. It displays an alert that gives three choices.

• Cancel Stops execution of the program permanently. This is the default choice.

• Suspend Stops execution of the program temporarily and returns to the command
window.
Select PROGRAM»RESUME to start again from the point where you left.

• Ignore Ignores ESC key and continues execution of the program.

Memory Variables

Memory variables are temporary quantities that are stored in the memory (RAM). They
are required in programs to store values which can be later used in calculations or to store
the results of calculation. A unique name, called the memory variable name, needs to be
assigned to each data item. It should be a maximum of 10 characters in length. The first
character of a memory variable must be a letter and spaces are not allowed. A memory
variable name can comprise letters, numerals, or underscore character (_). Declaring
Memory Variables Memory variables can be declared in any one of the two ways:

• Using STORE command

STORE <value> TO <memory variable name>

• Using an assignment operator

<memory variable name> = <value>

IA single STORE command can be used to declare more than one memory variable.

TECHNO INDIA GROUP Page No-70


BUSINESS SYSTEM Developed By Sangita Pal

Types of Memory Variables

• Character Composed of a combination of letters, numbers, and punctuation


symbols, enclosed in quotation marks.

Example:
STORE "UPTEC12" TO NUM
OR
NUM = "UPT1"

• Numeric Contains purely numbers, decimal point and ± sign.

Example:
STORE 55 TO N
OR
N = 532

• Date Contains dates that follow the Visual FoxPro's date format and are enclosed
in a pair of parentheses or ellipses.

Example:
STORE {03/18/97} TO DOJ
OR
DOJ ={03/18/97}

• Logical Stores either a logical T/F and should be enclosed by a pair of dots (.).

Example:
STORE .T. TO ANS
OR
ANS = T.

TECHNO INDIA GROUP Page No-71


BUSINESS SYSTEM Developed By Sangita Pal

Saving Memory Variables


SAVE command saves all or specified memory variables in the specified disk file.

Example:
SAVE TO MEMFILE1
SAVE TO MEMFILE2 ALL LIKE A*

Clearing Memory Variables


To clear all or specified memory variables, the following commands can be used:
RELEASE
CLEAR MEMORY

Example:
RELEASE ALL
CLEAR MEMORY
RELEASE ALL LIKE B *

Creating Empty Character Variables


SPACE function creates an empty character type memory variable of a specified length.

Example:
COUNTRY = SPACE (15)

Notes
Normally used in programs to display a blank area (of a specified length) for data entry
by the user.

TECHNO INDIA GROUP Page No-72


BUSINESS SYSTEM Developed By Sangita Pal

Using FoxPro Interactively

ACCEPT Command

Function: Displays a specified message (prompt) on the screen and accepts the data
entered through the keyboard in a character variable.

Syntax: ACCEPT <"Message"> TO variable

Example:
ACCEPT "Enter Employee Name:" TOEMPNAME
It stores the entered data in Empname variable. It automatically creates the variable
specified with ACCEPT.

INPUT Command

Function: Used to accept data entered through the keyboard in a character, numeric,
logical or date variable.

Syntax: INPUT <" Message" > TO variable

Example:
INPUT "Enter data:" TO CH

Different types of variables will be created depending upon the data entered.

Data Entered Variable Type Actual Data Stored in CH


500.50 Numeric 500.55
"Sachin* Character Sachin
'Sachin' Character Sachin
Sachin Character Sachin
.T. Logical T
{05/30/38} Date 05/30/98

TECHNO INDIA GROUP Page No-73


BUSINESS SYSTEM Developed By Sangita Pal

WAIT Command

Function: Used to pause the execution of the program. The following message is
displayed when it encounters WAIT.
Press Any Key To Continue...

Syntax: WAIT [<Character expression> To <Memory variables]

Example:
WAIT
WAIT "Press any key when printer is ready"
WAIT "Do you want to continue (Y/N):" TO ANS

Comments in Program Files

Comment lines (or remark lines) can be included anywhere in the program. A comment
line begins on a new line and starts with * or NOTE. Comments are non-executable
statements.

EOF( ) and BOF( ) Functions

EOF() determines whether or not the record pointer is positioned past the last record in
the current or specified table/.DBF or index file.
EOF() returns a logical true value (.T.) if the record pointer reaches the end of the file.
BOF() is determined if the record pointer is positioned at the beginning of a table/.DBF.
Returns true (.T.) if you try to move the record pointer to a position before the first logical
record in the Table/.DBF.

SKIP Command
Function: Moves the record pointer forward or backward in the current or specified
table/.DBF.

TECHNO INDIA GROUP Page No-74


BUSINESS SYSTEM Developed By Sangita Pal

Syntax: SKIP [<expNl>]


Here, <expNl> specifies the number of records to move the record pointer. Issuing SKIP
without <expNl> advances the record pointer to the next record.

Example:
SKIP
SKIP-3

Loop Constructs

In Visual FoxPro, three types of loops are used:


• DO WHILE.. .ENDDO
• FOR...ENDFOR
• SCAN...ENDSCAN

DO WHILE...ENDDO

Function: Executes a set of commands within a conditional loop.

Syntax: DO WHILE Expression


Commands
[LOOP]
[EXIT]
ENDDO

Expression Specifies a logical expression whose value determines whether the


commands between DO WHILE and ENDDO are executed. As long as Expression
evaluates to true (.T.), the set of commands are executed.

TECHNO INDIA GROUP Page No-75


BUSINESS SYSTEM Developed By Sangita Pal

Commands Specifies the set of Visual FoxPro commands to be executed as long as


Expression evaluates to true (.T.).

LOOP Returns program control directly back to DO WHILE. LOOP can be placed
anywhere between DO WHILE and ENDDO.

EXIT Transfers program control from within the DO WHILE loop to the first command
following ENDDO. EXIT can be placed anywhere between DO WHILE and ENDDO.

Commands between DO WHILE and ENDDO are executed for as long as the logical
expression. Expression remains true (.T.). Each DO WHILE statement must have a
corresponding ENDDO statement.

Comments can be placed after DO WHILE and ENDDO on the same line. The comments
are ignored during program compilation and execution.

Example:
• Program to generate numbers from 1 to 100.

CLEAR
N=1
DO WHILE N<= 100
?N
N = N+1
ENDDO

TECHNO INDIA GROUP Page No-76


BUSINESS SYSTEM Developed By Sangita Pal

FOR..ENDFOR Loop

Function: Executes a set of commands a specified number of times.

Syntax: FOR Var=nInitialValue TO nFinalValue [STEP nlncrement] Commands


[EXIT]
[LOOP]
ENDFOR INEXT

Var Specifies a variable or an array element that acts as the counter. The variable or array
element does not have to exist before FOR...ENDFOR is executed.

initialValue TO nFinalValue initialValue is the initial value of the counter, nFinalValue


is the final value of the counter.

STEP increment is the amount the counter is incremented or decremented. If increment


is negative, the counter is decremented. If you omit STEP, the counter is incremented by
1.
Commands body of the loop. It can include any number of commands.

Exit Transfers control from within the FOR.. .ENDFOR loop to the command
immediately following ENDFOR. You can place EXIT anywhere between FOR and
ENDFOR.

LOOP Returns control directly back to the FOR clause without executing the statements
between LOOP and ENDFOR. The counter is incremented or decremented as if
ENDFOR were reached. LOOP can be placed anywhere between FOR and ENDFOR.

TECHNO INDIA GROUP Page No-77


BUSINESS SYSTEM Developed By Sangita Pal

Examples:
• To generate first 1000 Numbers
FOR N=l TO 10
?N
ENDFOR

• To generate all even numbers less than or equal to 100


?" Even numbers"
FOR N=2 TO 100 STEP2
?N
ENDFOR

SCAN...ENDSCAN Loop

Function: This loop is specifically used for processing table files. It automatically
terminates when it reaches the end of the file. The record pointer is automatically moved
to the next record in a SCAN...ENDSCAN loop, so SKIP command is not specified.

Syntax: SCAN [Scope] [FOR Expression 1] [WHILE !Expression2]


[Commands]
[LOOP]
[EXIT]
ENDSCAN

Selection Construct (IF...ENDIF)


Selection permits selective execution of commands, depending on whether a given
condition is satisfied or not.

TECHNO INDIA GROUP Page No-78


BUSINESS SYSTEM Developed By Sangita Pal

Syntax:
IF Expression [THEN]
Commands
[ELSE Commands]
ENDIF
Notes
• For every IF there must be an ENDIF.
ELSE Part is optional
• You can nest an IF...ENDIF block within another IF..ENDIF block.
Every ENDIF is matched with the nearest unmatched IF.
• Comments proceeded by && can be placed on the same line after IF, THEN,
ELSE, and ENDIF. These comments are ignored during compilation and program
execution.

Example:
The following program accepts an employee code from the user through ACCEPT
command and then using SEEK command finds the code in the employee table.

CLEAR
USE EMPLOYEE INDEX ECODE
ACCEPT "Enter Employee code" TO EC
SEEK EC
IF FOUND ( )
? "Employee code: " + EMPCODE
? "Employee Name:" + EMPNAME
?
ENDIF
CLOSE ALL
RETURN

TECHNO INDIA GROUP Page No-79


BUSINESS SYSTEM Developed By Sangita Pal

Multiple Selection Construct (DO CASE...ENDCASE)


If there are many conditions then instead of using multiple IFs, DOCASE... .ENDCASE
statement is used.
It executes the first set of commands whose conditional expression evaluates to true (.T.).

Syntax:
DO CASE
CASE Expressionl
Commands
[CASE Expression2]
Commands
…………….
CASE ExpressionN
Commands
[OTHERWISE Commands]
ENDCASE

CASE Expression1 Commands When the first true (.T.) CASE expression is
encountered; the set of commands following it is executed. Execution of the set of
commands continues until the next CASE or ENDCASE is reached. Execution then
resumes with the first command following ENDCASE.

If a CASE expression is false (.F.), the set of commands following it up to the next CASE
clause is ignored. Only one set of commands is executed. These are the first commands
whose CASE expression evaluates to true (.T.). Any succeeding true (.T.) CASE
expressions are ignored.

OTHERWISE Command If all of the CASE expressions evaluate to false (.F.),


OTHERWISE determines if an additional set of commands is executed. If you include

TECHNO INDIA GROUP Page No-80


BUSINESS SYSTEM Developed By Sangita Pal

OTHERWISE, the commands following OTHERWISE are executed and execution skips
to the first command following ENDCASE.
If you omit OTHERWISE, execution skips to the first command following ENDCASE.

Example:
CLEAR
N1=0
N2 = 0
T=0
INPUT "Enter first Number: " To N1
INPUT "Enter Second Number:" TO N2
CLEAR

? "Main Menu"
? " A. Addition"
? " B. Subtraction"
?"C. Multiply"
? "D. Divide"
? " E. Exit"
ACCEPT "Enter choice To UPPER (CH)

DO CASE
CASE CH = "A"
T = N1+N2
CASE CH="B"
IF N1>N2
T = N1-N2
ELSE
T=N2-N1
ENDIF

TECHNO INDIA GROUP Page No-81


BUSINESS SYSTEM Developed By Sangita Pal

CASE CH="C"
T = N1*N2
CASE CH="D"
IF N1>N2
T = N2/N1
ELSE
T = N1/N2
ENDIF
CASE CH="E"
RETURN
OTHERWISE
? "Invalid Option..."
ENDCASE
? "Result is", T
RETURN

I IF ( ) S t a t e m e n t s
Function: Returns one of two values depending on the value of a logical expression.

Syntax: IIF(Condition, Expressionl , Expression2)

Returns: Character, Numeric, Currency, Date, or DateTime

Condition Specifies the logical expression that IIF( )evaluates


Expressionl, Expression2 If Expression1 evaluates to true (.T.), Expression1 is returned.
If Expression1 evaluates to false (.F), Expression2 is returned.
This function, also known as Immediate IF, evaluates a logical expression and then
returns one to two expressions. If the logical expression evaluates to true (.T.), IIF()
returns the first expression. If the logical expression evaluates to false (.E), IIF() returns
the second expression. The IIF()function also executes faster than an equivalent
IF...ENDIF. It is a one line version of IF...ELSE...ENDIF.

TECHNO INDIA GROUP Page No-82


BUSINESS SYSTEM Developed By Sangita Pal

Example:
?IIF(AGE>19, "Eligible to vote", "Not eligible to vote")

Example of Nested DO...WHILE Loop


To use one DO WHILE loop within another is known as nesting.

Example:

CLEAR
N=1
DO WHILE N<6
M=l
DO WHILE M < =N
??M
M = M+1
ENDDO
?
N = N+1
ENDDO
RETURN

Example of NESTED IF

CLEAR
?
INPUT "Enter any number between 1 and 4" TO NUM
?
IF NUM = 1
? "You entered one"
ELSE

TECHNO INDIA GROUP Page No-83


BUSINESS SYSTEM Developed By Sangita Pal

IF NUM =2
? "You entered two"
ELSE
IF NUM =3
? "You entered three"
ELSE
IF NUM =4
? "You entered four"
ELSE
? "Error"
ENDIF
ENDIF
?
WAIT

Programming Macros

Used specifically within programs. &(ampersand) is Macro substitution operator. This


operator is placed in front of the memory variable name, and the combination of
ampersand and variable name becomes the FoxPro macro.

For example, &NAME, &INVOICE.


Then, whenever Visual FoxPro sees the macro, it replaces it with the contents of the
memory variable.

Example:

ACCEPT "Enter file name to open" TO FILENAME


ACCEPT "Find what?" TO FINDJVAL
ACCEPT "Find in which Field?" TO FIELD

TECHNO INDIA GROUP Page No-84


BUSINESS SYSTEM Developed By Sangita Pal

USE & FILENAME


INDEX ON & FIELD TO NEW
FIND & FINDJVAL
IFFOUNDQ
DISPLAY
ENDIF
CLOSE ALL

The @ Command
It is the most powerful and flexible command used for purposes such as:
• To place data at a particular screen location.
• To input data in fields or memory variables.
• To retrieve data.
• To input data through check boxes, radio buttons, push buttons, etc.
• To draw or clear boxes and lines.

Displaying Data - @...SAY


This command displays output at a specified row and column position. Formatted output
can be displayed in the main FoxPro window or in user-defined window.

Syntax: @ <row, col> SAY <expr>

<row, col>
Numeric expression. Row starts from 0-23 in FoxPro for DOS and from 0-35 in FoxPro
for Windows; and columns are numbered from 0 to 79, although results in FoxPro for
Windows might vary depending on your display.

<expr>
Specifies what is to be displayed. <expr> can include the expression that is to be
evaluated, displayed or printed starting at <row, col>.

TECHNO INDIA GROUP Page No-85


BUSINESS SYSTEM Developed By Sangita Pal

Some Useful Commands

& Command
Performs macro substitution.
Macro substitution statements that appear in DO WHILE, FOR, and SCAN are evaluated
only at the start of the loop and are not reevaluated on subsequent iterations. Any changes
to the variable or array element that occur within the loop are not recognized.

&& Command
Indicates the beginning of a non executing inline comment in a program file.
Inserting inline comments to denote the end of the IF ... ENDIF, DO, and FOR ...
ENDFOR structured programming commands greatly improves the readability of
programs when including many such structures.

* Command
Indicates the beginning of a non executing comment line in a program file.

= Command
Evaluates one or more expressions.
Specifies the expression or expressions that the = command evaluates.
The = command evaluates one or more expressions, Expression1, Expression2 ..., and
discards the return values. This option is particularly useful when a Visual FoxPro
function or a user-defined function has a desired effect, but there is no need to assign the
function's return value to a variable, array element, or field.

? | ?? Command
Evaluates expressions and sends the results to the main Visual FoxPro window, an active
user-defined window, or the printer.

TECHNO INDIA GROUP Page No-86


BUSINESS SYSTEM Developed By Sangita Pal

? Expression1
Evaluates the expression specified by Expression1 and sends a carriage return and line
feed preceding the expression results.

?? Expression1
Evaluates the expression specified by Expression1 and displays the expression results on
the current line at the current position of the main Visual FoxPro window,

??? Command
Sends output directly to the printer.

@ ... SAY Command


Included for backward compatibility. Use the Label Control to display text and the
TextBox Control to display the contents of fields and variables.

\ | \\ Command
Prints or displays lines of text.
\ TextLine
When you use \, the text line is preceded by a carriage return and a line feed.
\\ TextLine
When you use \\, the text line is not preceded by a carriage return and a line feed.

ACTIVATE WINDOW Command


Displays and activates one or more user-defined windows or Visual FoxPro system
windows.
ACTIVATE WINDOW WindowName1 [, WindowName2 ...]

ACTIVATE SCREEN Command


Sends all subsequent output to the main Visual FoxPro window instead of to the active
user-defined window.
Use ACTIVATE WINDOW to direct output to a user-defined window.

TECHNO INDIA GROUP Page No-87


BUSINESS SYSTEM Developed By Sangita Pal

APPEND Command
Adds one or more new records to the end of a table.
APPEND [BLANK]
Adds one blank record to the end of the current table. Visual FoxPro does not open an
editing window when you issue APPEND BLANK.

When you issue APPEND or APPEND BLANK and a table isn't open in the currently
selected work area, the Open dialog appears so that you can choose a table to which you
can append records.

APPEND opens an editing window so you can enter data into one or more new records.
When you add a new record, Visual FoxPro updates any indexes that are open.

APPEND FROM Command


Adds records to the end of the currently selected table from another file.
APPEND FROM FileName

ASSERT Command
Displays a message box when a logical expression evaluates to False (.F.).
When the condition stipulated in the ASSERT command evaluates to False (.F.), an assert
message box displays and echoes to the Debug Output window in the Debugger.

AVERAGE Command
Computes the arithmetic average of numeric expressions or fields.
AVERAGE [ExpressionList] [FOR lExpression1] [WHILElExpression2]

BLANK Command
Clears data from the specified fields in the current record or from all fields in the current
record when issued without additional arguments.
BLANK [FIELDS FieldList] [FOR lExpression1] [WHILE lExpression2]

TECHNO INDIA GROUP Page No-88


BUSINESS SYSTEM Developed By Sangita Pal

Note
BLANK does not clear field data of a record in another related work area if the record
pointer is at the end of the file in the current work area. The record pointer must be on a
record in the current work area in order for BLANK to act on the fields in the related
record.

BROWSE Command
Opens the Browse window and displays records from the current or selected table.

CANCEL Command
Ends execution of the current Visual FoxPro program file.
Control returns to the Command window when Visual FoxPro is being used interactively.
If a distributed run-time application is running, CANCEL terminates the application and
control returns to Windows. If a program is executing in Visual FoxPro during design
time, CANCEL terminates the program and control returns to the Command window.
Executing CANCEL releases all private variables.

CLEAR Commands
Releases the specified item or items from memory.
CLEAR [ALL]

CLEAR erases the main Visual FoxPro window or the current user-defined window, and
releases from memory all pending @ ... GET controls. You can include CLEAR in format
files.

CLOSE Commands
Closes various file types.
CLOSE [ALL | ALTERNATE | DATABASES [ALL]

TECHNO INDIA GROUP Page No-89


BUSINESS SYSTEM Developed By Sangita Pal

CONTINUE Command
Continues the previous LOCATE.

Remarks
CONTINUE is used after LOCATE succeeds in finding a record, to continue the
LOCATE operation. CONTINUE moves the record pointer to the next record for which
the logical expression specified in the previous LOCATE evaluates to True (.T.).

CONTINUE can be repeated until the end of the file is encountered, or until the end of
the scope you specified with LOCATE is reached.

If CONTINUE succeeds in finding a record, RECNO( ) returns the record number of the
record, FOUND( ) returns a value of True (.T.), and EOF( ) returns a value of False (.F.).

If CONTINUE doesn't succeed in finding a record, RECNO( ) returns the number of


records in the table plus one, FOUND( ) returns False (.F.), and EOF( ) returns True (.T.).

COPY FILE Command


Duplicates any type of file.
COPY FILE FileName1 TO FileName2

Remarks
COPY FILE creates a duplicate of the file whose name is specified in FileName1. You
can use COPY FILE to copy any type of file. The file to be copied cannot be open. You
must include the extensions for both the source file name FileName1 and destination file
name FileName2.

COPY STRUCTURE Command


Creates a new, empty table with the same structure as the currently selected table.
COPY STRUCTURE TO TableName

TECHNO INDIA GROUP Page No-90


BUSINESS SYSTEM Developed By Sangita Pal

COPY PROCEDURES Command


Copies stored procedures in the current database to a text file.
COPY PROCEDURES TO FileName
Use COPY PROCEDURES with APPEND PROCEDURES to programmatically modify
stored procedures in a database. A database must be open and current when COPY
PROCEDURES is issued; otherwise Visual FoxPro generates an error message.

COPY TO Command
Creates a new file from the contents of the currently selected table.
COPY TO FileName [DATABASE DatabaseName]

COUNT Command
Counts table records.
COUNT [Scope] [FOR lExpression1] [WHILE lExpression2] [TO VarName]

COUNT counts the records within a scope of records for which the FOR or WHILE
conditions are true. If SET TALK is ON, the record count is displayed.
Records marked for deletion are included in the count if SET DELETE is OFF.

CREATE Command
Opens the Table Designer so you can create a Visual FoxPro table.
If a database is open when you create a table, the table is added automatically to the
database.

When running on the Windows operating system, you cannot create a table with the name
of an MS-DOS device, such as CON, NUL, PRN, and COM1. Avoid using hyphens in a
table name because hyphenated table names do not appear in the Data Session window
and can cause confusion with the alias pointer (->).

After opening the Table Designer, you need to define attributes for the fields in the table.
After you create the table structure, you can add records to the table. For more
information, see Creating Tables.

TECHNO INDIA GROUP Page No-91


BUSINESS SYSTEM Developed By Sangita Pal

CREATE DATABASE Command


Creates and opens a database.
CREATE DATABASE [DatabaseName]

A database (.dbc) file is created with an associated database memo (.dct) file and database
index (.dcx) file.

The database opens exclusively, regardless of the setting of SET EXCLUSIVE. Because
CREATE DATABASE opens the database after it has been created, you do not need to
call a subsequent OPEN DATABASE command.

Using CREATE DATABASE does not add the database automatically to a project even
when the Project Manager is open. You must explicitly add a database to an application
project to include it.

CREATE FORM Command


Opens the Form Designer.
CREATE FORM [FormName]

Remarks
Issuing CREATE FORM without any additional arguments opens a new form in the Form
Designer. When you exit the Form Designer, you are prompted to save the form with a
different name.

CREATE LABEL Command


Opens the Label Designer to create a label in standard label format or to design a custom
label.

CREATE LABEL [FileName]


You can also create labels using a wizard.

TECHNO INDIA GROUP Page No-92


BUSINESS SYSTEM Developed By Sangita Pal

CREATE MENU Command


Opens the Menu designer in Visual FoxPro.
CREATE MENU [FileName]

Remarks
Issuing CREATE MENU without any additional arguments opens the Menu designer
within which you can define a menu system. The name MENU1 is temporarily assigned
to the menu definition table. When you exit the Menu designer, you can save the menu
definition under a different name.

CREATE PROJECT Command

Opens the Project Manager so you can create a project.


CREATE PROJECT [FileName]

A project is a table that keeps track of all files that are required to create an application, as
well as all dependencies, references, and connections among the files. A project table has
a .pjx extension and an associated memo file with a .pjt extension. In a project, you
specify all the pieces that are required for an application, and Visual FoxPro ensures that
compiled files are based on the latest source files.

A project table can be opened with USE and manipulated like any other Visual FoxPro
table.

Issuing the command CREATE PROJECT without any additional arguments displays the
Create dialog, allowing you to specify a name for the project.

CREATE QUERY Command


Opens the Query designer.
CREATE QUERY [FileName] [NOWAIT]

TECHNO INDIA GROUP Page No-93


BUSINESS SYSTEM Developed By Sangita Pal

CREATE QUERY opens the Query designer so you can interactively create a query.
After you create a query, the query is stored as a Visual FoxPro program file with a .qpr
extension. A query program can be executed with DO. You must include the query file
extension when executing a query with DO, as shown in the following example.
DO my_query.qpr

Issuing the command CREATE QUERY without any additional arguments opens a new
query window. The name QUERY1 is assigned to the query. When you exit the Query
window, you can save the query with a different name.

CREATE REPORT Command


Opens the Report Designer to create a report in standard report format or to design a
custom report.
CREATE REPORT [FileName]

You can also create reports using a wizard. You can also create quick reports without
opening the Report Designer using another version of CREATE REPORT.

DEACTIVATE WINDOW Command


Deactivates user-defined windows or Visual FoxPro system windows and removes them
from the screen, but not from memory.
DEACTIVATE WINDOW WindowName1 [, WindowName2 ...] | ALL

More than one user-defined window can be placed in the main Visual FoxPro window at
the same time, but output is directed only to the most recently activated user-defined
window. When more than one user-defined window is present, deactivating the current
user-defined output window clears the contents of the window, removes the window from
the screen and sends subsequent output to the previously activated user-defined window.
If there is no output window, output is directed to the main Visual FoxPro window.

TECHNO INDIA GROUP Page No-94


BUSINESS SYSTEM Developed By Sangita Pal

Use CLEAR WINDOWS or RELEASE WINDOWS to remove windows from both the
screen and memory.

To deactivate a system window and or a toolbar (in Visual FoxPro), enclose the entire
system window or toolbar name in quotation marks. For example, to deactivate the
Report Controls toolbar in Visual FoxPro, issue the following command:
DEACTIVATE WINDOW "Report Controls"

DECLARE Command
Creates a one- or two-dimensional array.
You can use either brackets or parentheses to enclose the expressions in DECLARE.

DEBUG Command
Opens the Visual FoxPro debugger.

The debugger Environment setting (FoxPro Frame or Debugger Frame) determines if the
debugger is placed on the Visual FoxPro desktop or in a separate window. Toggle this
setting in the Debugging tab of the Options dialog box.

If you issue DEBUG when the debugger is open, the debugger becomes the active
window.

DEFINE WINDOW Command


Creates a window and specifies its attributes.

After user-defined windows are created with DEFINE WINDOW, they can be displayed
in the main Visual FoxPro window with ACTIVATE WINDOW or SHOW WINDOW.
The number of user-defined windows you can create is limited only by the amount of
available memory and system resources.

TECHNO INDIA GROUP Page No-95


BUSINESS SYSTEM Developed By Sangita Pal

Activated windows remain in the main Visual FoxPro window until DEACTIVATE
WINDOW or HIDE WINDOW is issued. DEACTIVATE WINDOW and HIDE
WINDOW remove windows from the main Visual FoxPro window but don't remove the
window definitions from memory. Windows can be placed back in the main Visual
FoxPro window with ACTIVATE WINDOW or SHOW WINDOW.

Use CLEAR WINDOWS or RELEASE WINDOWS to remove windows from the main
Visual FoxPro window and window definitions from memory. Windows whose
definitions have been removed from memory must be recreated with DEFINE WINDOW
in order to be redisplayed.

DELETE Command
Marks records for deletion.

DELETE [Scope] [FOR lExpression1] [WHILE lExpression2]

Records marked for deletion aren't physically removed from the table until PACK is
issued. Records marked for deletion can be recalled (unmarked) with RECALL.

DELETE DATABASE Command


Deletes a database from disk.
DELETE DATABASE DatabaseName

Always use DELETE DATABASE to delete a database from disk. Unlike the file
manipulation utility of the operating system, DELETE DATABASE removes references
to the database from the tables in the database.

If SET SAFETY is ON, Visual FoxPro asks if you'd like to delete the database you
specify. If SET SAFETY is OFF, the database is automatically deleted from disk.

TECHNO INDIA GROUP Page No-96


BUSINESS SYSTEM Developed By Sangita Pal

DELETE FILE Command


Erases a file from a disk.
DELETE FILE [FileName]

The file you want to delete cannot be open when DELETE FILE is issued. The file name
must include a path if it is on a different drive or volume, or in a different directory from
the default. A file name extension must be included.

If the file you want to delete represents a table that is part of a database, you need to
remove the table from the database before deleting the file. You can use the REMOVE
TABLE command before using the DELETE FILE command. If you delete a table that
has an associated .FPT memo file, be sure to delete the memo file.

This command does not generate an error if the specified file does not exist.
The DELETE FILE command is the same as the ERASE command.

The file you want to delete cannot be open when DELETE FILE is issued. The file name
must include a path if it is on a different drive or volume, or in a different directory from
the default. A file name extension must be included.

DISPLAY Command
Displays record contents and expression results for the current table in the main Visual
FoxPro window or a user-defined window.
DISPLAY [FIELDS][FOR lExpression1] [WHILE lExpression2]

DISPLAY is similar to the LIST command except that DISPLAY displays information
one screen at a time and pauses between screens. LIST displays the same information
without pausing. To view the next screen, press any key or click anywhere in the Visual
FoxPro window.

TECHNO INDIA GROUP Page No-97


BUSINESS SYSTEM Developed By Sangita Pal

DISPLAY DATABASE Command


Displays information about the current database.
DISPLAY DATABASE
To return additional information about the current database,

DISPLAY FILES Command


Displays information about files.
DISPLAY FILES

Use DISPLAY FILES to display information about files residing on a disk. You can
display information about all files on a specified drive, volume, directory, or folder.

Issuing DISPLAY FILES without any arguments displays information about tables in the
current directory. The information displayed includes the following:
• Table name.
• Number of records in the table.
• Date and time of the last update to the table.
• The size of each table in bytes.
• If each table is part of a database.

DISPLAY PROCEDURES Command


Displays the names of procedures stored in the current database.
DISPLAY PROCEDURES

Stored procedures are created with APPEND PROCEDURES, COPY PROCEDURES, or


MODIFY PROCEDURE.

DISPLAY STRUCTURE Command


Displays the structure of a table file. The name of each field in the table is displayed with
its type and width.

TECHNO INDIA GROUP Page No-98


BUSINESS SYSTEM Developed By Sangita Pal

DISPLAY STRUCTURE also displays the following:


• The total width of all fields.

• The number of decimal places in the field if the field has Numeric, Double, or

Float type.

• Null value support for each field.

• If the field is an auto incrementing field, the Next and Step values in the last two

columns.

• The current number of records in the table and the date it was last updated.

• The memo field blocks size if the table has an associated memo field.

• The code page of the table.

• If the table is associated with a structural compound index, and if a tag, or index

entry, in the structural compound index has the same name as a field in the table,

DISPLAY STRUCTURE displays the order of the tag, ascending or descending, and the

collation sequence for the tag next to the field name.

DISPLAY TABLES Command


Displays names and information about all the tables contained in the current database.
DISPLAY TABLES
The information returned is a subset of the information shown using DISPLAY STATUS.
However, the information displayed using DISPLAY TABLES contains only table-
related information and displays the information regardless of whether the tables are open
or not.

The following information is displayed:


• Table name
• Table path

TECHNO INDIA GROUP Page No-99


BUSINESS SYSTEM Developed By Sangita Pal

DO CASE ... ENDCASE Command


Executes the first set of commands whose conditional expression evaluates to true (.T.).

DO CASE
CASE lExpression1
[Commands]
[CASE lExpression2
[Commands]]
...
[CASE lExpressionN
[Commands]]
[OTHERWISE
[Commands]]
ENDCASE

DO CASE is used to execute a set of Visual FoxPro commands based on the value of a
logical expression. When DO CASE is executed, successive logical expressions are
evaluated; the values of the expressions determine which set of commands is executed.
Comments can be placed after DO CASE and ENDCASE on the same line. The
comments are ignored during program compilation and execution.

DO Command
Executes a Visual FoxPro program or procedure.

When you use DO to run a program, the commands contained in the program file are
executed until one of the following occurs:
• RETURN is encountered.
• CANCEL is executed.
• Another DO is issued.
• The end of the file is reached.
• QUIT is executed.

TECHNO INDIA GROUP Page No-100


BUSINESS SYSTEM Developed By Sangita Pal

When program execution is complete, control is returned to one of the following:


• Program that called DO
• Command window
• Operating system

If you choose Do from the Program menu and execute a program in a directory on a drive
other than the current directory or drive, Visual FoxPro automatically changes the default
directory and drive to the directory and drive containing the program.

DO FORM Command
Runs a compiled form or form set created with the Form Designer.
DO FORM FormName
DO FORM executes the Show method for the form or form set.

DO WHILE ... ENDDO Command


Executes a set of commands within a conditional loop.

DO WHILE Expression1
Commands
[LOOP]
[EXIT]
ENDDO

Commands between DO WHILE and ENDDO are executed for as long as the logical
expression Expression1 remains true (.T.). Each DO WHILE statement must have a
corresponding ENDDO statement.

Comments can be placed after DO WHILE and ENDDO on the same line. The comments
are ignored during program compilation and execution.

TECHNO INDIA GROUP Page No-101


BUSINESS SYSTEM Developed By Sangita Pal

DROP TABLE Command


Removes a table from the current database and deletes it from disk.
DROP TABLE TableName

When DROP TABLE is issued, all primary indexes, default values, and validation rules
associated with the table are also removed. DROP TABLE also affects other tables in the
current database if those tables have rules or relations associated with the table being
removed. The rules and relations are no longer valid when the table is removed from the
database.

EDIT Command
Displays fields for editing.
EDIT allows you to edit the selected table within a window. EDIT behaves identically to
CHANGE.

If you press ESC to exit the Edit window, changes made to the last field you modified are
discarded. However, if you move to another record after modifying a field, your changes
to the field are saved.

ERASE Command
Deletes a file from disk.
This command does not generate an error if the specified file does not exist.
The DELETE FILE command is the same as the ERASE command.

EXIT Command
Exits a DO WHILE, FOR, SCAN, or TRY…CATCH…FINALLY structure.
The EXIT command transfers control from within the structure to the command
immediately following the structure.

TECHNO INDIA GROUP Page No-102


BUSINESS SYSTEM Developed By Sangita Pal

FOR EACH ... ENDFOR Command


Executes a set of commands for each element in a Visual FoxPro array or collection.

FOR EACH Var


Commands
[EXIT]
[LOOP]
ENDFOR | NEXT

FOR ... ENDFOR Command


Executes a set of commands a specified number of times.

FOR VarName = nInitialValue TO nFinalValue [STEP nIncrement]


Commands
[EXIT]
[LOOP]
ENDFOR | NEXT

The Visual FoxPro commands that appear in the FOR loop execute until ENDFOR or
NEXT is reached. The value in the counter VarName then increments or decrements by
the value of nIncrement. The value of the counter is then compared with nFinalValue. If
the counter is less than or equal to nFinalValue, the commands following the FOR clause
execute again. If the counter is greater than nFinalValue, the FOR ... ENDFOR loop exits,
and program execution continues with the first command following ENDFOR or NEXT.

GATHER Command
Replaces the data in the current record of the currently selected table with data from an
array, a set of variables, or an object.
GATHER FROM ArrayName

TECHNO INDIA GROUP Page No-103


BUSINESS SYSTEM Developed By Sangita Pal

GOTO Command
Moves the record pointer to the specified record number. There are multiple versions of
the syntax.

GO [RECORD] nRecordNumber
GO TOP | BOTTOM
GOTO [RECORD] nRecordNumber

You can use GO and GOTO interchangeably. These commands operate on the table in the
current work area unless you specify another work area with the IN clause.

If you use the nRecordNumber argument with GOTO and the specified physical record
does not exist in the table, the system will throw a "Record is out of range" error. The
record pointer will not move.

HIDE WINDOW Command


Hides an active user-defined window or Microsoft Visual FoxPro system window.
HIDE WINDOW WindowName1 [, WindowName2 ... ] | ALL

HIDE WINDOW removes a window or a set of windows from the main Visual FoxPro
window or from a user-defined window. You can use HIDE WINDOW to hide system
windows, such as the Command window, the Data Session window, and so on.

Hiding a window isn't the same as closing it. When a window is hidden, it stays resident
in memory and remains active. Output can be sent to a hidden window, but you cannot
see it.

Releasing a window removes it from memory. Windows removed from memory must be
defined again to be redisplayed. A window can be displayed with ACTIVATE WINDOW
or SHOW WINDOW.

TECHNO INDIA GROUP Page No-104


BUSINESS SYSTEM Developed By Sangita Pal

IF ... ENDIF Command


Conditionally executes a set of commands based on the value of a logical expression.

IF Expression [THEN]
Commands
[ELSE
Commands]
ENDIF

You can nest an IF ... ENDIF block within another IF ... ENDIF block.
Comments proceeded by && can be placed on the same line after IF, THEN, ELSE, and
ENDIF. These comments are ignored during compilation and program execution.

IMPORT Command
Imports data from an external file format to create a new Visual FoxPro table.
Most software packages store their data in file formats that cannot be opened directly in
Visual FoxPro. IMPORT creates a new Visual FoxPro table from data stored in file
formats that Visual FoxPro cannot directly read.

A new table is created with the same name as the file from which the data is imported. A
.dbf extension is assigned to the newly created table.

INDEX Command
Creates an index file containing one or more indexes for displaying and accessing table
records in a specified order.

A structural .cdx file can become dissociated from its table if the index file cannot be
located, is deleted, or renamed. When you open a table that has a dissociated structural
.cdx file, a dialog box appears. When you click Cancel in the dialog box, the table does
not open.

TECHNO INDIA GROUP Page No-105


BUSINESS SYSTEM Developed By Sangita Pal

LABEL Command
Sends labels from a label file (.lbx) to the specified output.
You can create label files using the CREATE LABEL Command or MODIFY LABEL
Command.

When you use Visual FoxPro's object-assisted output mode, all the clauses of the LABEL
FORM command are available to your ReportListener in its CommandClauses member
object, with the exception of record selection clauses (scope, FOR, and WHILE). You can
use the CommandClauses. RecordTotal attribute for information about the scope of the
label run, or assign these values to your ReportListener object before running your labels.

LIST Commands
Displays table or environment information without pausing the main Visual FoxPro or
user-defined window. There are multiple versions of the syntax.

LIST [FIELDS FieldList][FOR Expression1]


[WHILE lExpression2]

LIST STRUCTURE

Remarks
The LIST commands are identical to the DISPLAY commands except for the following
differences:

* LIST displays information without pausing, whereas DISPLAY displays the first
screen of information and then pauses. For more information, see DISPLAY Command.

* The scope for LIST defaults to ALL records.

LIST DATABASE Command


Continuously displays information about the current database.
LIST DATABASE

TECHNO INDIA GROUP Page No-106


BUSINESS SYSTEM Developed By Sangita Pal

LIST PROCEDURES Command


Continuously displays the names of stored procedures in the current database.
Stored procedures are created with MODIFY PROCEDURES.

LIST TABLES Command


Displays without pausing all tables and information about the tables contained in the
current database.
The information returned includes the table names and paths and is a subset of the
information shown using LIST STATUS. However, the information displayed using LIST
TABLES contains only table-related information and displays the information regardless
of whether the tables are open.

LOCATE Command

Sequentially searches the table for the first record that matches the specified logical
expression.
LOCATE [FOR lExpression1] [WHILE lExpression2]

The table doesn't have to be indexed.


If you use the LOCATE command without the FOR expression, Visual FoxPro positions
the record pointer at the first logical record.

If LOCATE finds a matching record, you can use RECNO( ) to return the number of the
matching record. If a matching record is found, FOUND( ) returns true (.T.), and EOF( )
returns false (.F.).

After LOCATE finds a matching record, you can issue CONTINUE to search the
remainder of the table for additional matching records. When CONTINUE is executed,
the search process resumes, starting with the record immediately following the matching
record. You can issue CONTINUE repeatedly until the end of the scope or the end of the
table is reached.

TECHNO INDIA GROUP Page No-107


BUSINESS SYSTEM Developed By Sangita Pal

If a match isn't found, RECNO( ) returns the number of records in the table plus 1,
FOUND( ) returns false (.F.), and EOF( ) returns true (.T.).

LOCATE and CONTINUE are specific to the current work area. If another work area is
selected, the original search process can be continued when the original work area is
reselected.

LOOP Command

Returns program control directly to the beginning of a looping structure.

You can place LOOP anywhere between DO WHILE and ENDDO, anywhere between
FOR and ENDFOR or FOR EACH and ENDFOR, or anywhere between SCAN and
ENDSCAN.

The LOOP command returns control directly to the DO WHILE, FOR, or FOR EACH
clause without executing the statements between LOOP and ENDDO or ENDFOR. The
counter is incremented or decremented as if the END... statement were reached.

MODIFY COMMAND Command


Opens an editing window so you can modify or create a program file.
MODIFY COMMAND [FileName]

MODIFY DATABASE Command


Opens the current database in the Database Designer so you can visually modify the
database.

MODIFY DATABASE [DatabaseName]

MODIFY FORM Command


Opens the Form Designer so you can modify or create a Form.
Issuing MODIFY FORM without any arguments displays the Open dialog box. You can
save the form with a different name when you close the Form Designer.

TECHNO INDIA GROUP Page No-108


BUSINESS SYSTEM Developed By Sangita Pal

MODIFY LABEL Command


Opens the Label Designer to create or modify a label.
MODIFY LABEL [FileName]

You can edit labels using the Visual FoxPro user interface.

MODIFY PROCEDURE Command


Opens the Visual FoxPro text editor, making it possible for you to create new stored
procedures for the current database, or modify existing stored procedures in the current
database.

A database must be open before you can create or modify stored procedures.

MODIFY FILE Command


Opens an editing window so you can modify or create a text file.
MODIFY FILE [FileName]

When modifications are made to a text file, the updated file is written to disk. In Visual
FoxPro, a backup file with a .bak extension is created if you select the Make Backup
Copy check box on the Edit Properties dialog box, which appears when you choose
Properties from the Edit menu. In previous versions of FoxPro, a backup file with a .bak
extension is created if you select the Backup check box in the Preferences dialog box,
which appears when you choose Preferences from the Edit menu.

MODIFY PROJECT Command


Opens the Project Manager so you can modify or create a project file.
MODIFY PROJECT [FileName]

In a project, you specify all the source files that are required for a final application, and
then Visual FoxPro makes sure the generated application is based on the latest source
files.

TECHNO INDIA GROUP Page No-109


BUSINESS SYSTEM Developed By Sangita Pal

A project file is a table that keeps track of all the source files such as programs, forms,
menus, libraries, reports, labels, tables, indexes, and format files. A project also keeps
track of all the dependencies, references, and connections among the files.

MODIFY QUERY Command


Opens the Query designer so you can modify or create a query.
MODIFY QUERY [FileName]

Issuing MODIFY QUERY without any arguments displays the Open dialog box. If you
choose New from this dialog box, the name QUERY1 is assigned to the query. You can
save the query with a different name when you exit the Query Designer.

After you have created a query, the query is stored as a Visual FoxPro program file with a
.qpr extension. You can execute a query program with DO, but you must include the .qpr
extension with the query file name.

MODIFY REPORT Command


Opens the Report Designer to create or modify a report.
MODIFY REPORT [FileName]
You can also edit reports using the Visual FoxPro user interface.

MODIFY STRUCTURE Command


Displays the Table designer, making it possible for you to modify the structure of a table.

Remarks
In previous versions of FoxPro, MODIFY STRUCTURE opens the Table Structure
dialog box.

If a table isn't open in the currently selected work area, the Open dialog box is displayed,
making it possible for you to choose a table to modify. Changes you can make to a table's
structure include adding and deleting fields; modifying field names, sizes, and data types;
adding, deleting, or modifying index tags; and specifying null value support for fields.

TECHNO INDIA GROUP Page No-110


BUSINESS SYSTEM Developed By Sangita Pal

MODIFY WINDOW Command


Modifies a user-defined window or the main Visual FoxPro window.
MODIFY WINDOW changes the attributes of an existing user-defined window (a
window created with DEFINE WINDOW) or the main Visual FoxPro window. MODIFY
WINDOW can't be used to change the attributes of Visual FoxPro system windows (such
as the Command window and Browse window).

Use MODIFY WINDOW to change the location, default font, title, border, controls, icon,
wallpaper, and color of a user-defined window or the main Visual FoxPro window. You
can change any of these attributes by including the optional clauses for the MODIFY
WINDOW command. (Note that if you change colors, you must use CLEAR to apply the
color changes.)

MOVE WINDOW Command


Moves a user-defined window created with DEFINE WINDOW, or a Visual FoxPro
system window (such as the Command window or Browse window) to a new location.
MOVE WINDOW WindowName TO nRow1, nColumn1 | BY nRow2, nColumn2 |
CENTER

A window can be moved to a specific position or relative to its current position. If a


window is defined, it can be moved; it doesn't have to be active or visible.
To move a system window and or a toolbar (in Visual FoxPro), enclose the entire system
window or toolbar name in quotation marks. For example, to move the Report Controls
toolbar (when it isn't docked) in Visual FoxPro, issue the following command:

PACK Command
Permanently removes all records marked for deletion in the current table and reduces the
size of the table memo (.fpt) file associated with the table.
You must first open the table exclusively before using the PACK command.

TECHNO INDIA GROUP Page No-111


BUSINESS SYSTEM Developed By Sangita Pal

When you use PACK, Microsoft Visual FoxPro copies all records not marked for deletion
to a temporary table. After PACK is finished executing, Visual FoxPro deletes the
original table from disk and renames the temporary table with the original table name. If
you press the ESC key to cancel PACK, the temporary table is deleted, and the original
table remains unchanged. The original table is also recovered if you run out of disk space
while PACK is executing.

When you issue PACK without the MEMO and DBF clauses, PACK affects both the
table and the memo file.
PACK requires exclusive use of the table. For more information about opening a table
exclusively on a network, see SET EXCLUSIVE Command.

ON ERROR Command
Specifies a valid expression or Visual FoxPro command to execute when an error occurs
in code at run time.

If the error-handling procedure includes the RETRY command, the program executes the
line that caused the error instead of continuing on the immediate following line. For more
information, see RETRY Command.
You cannot nest ON ERROR commands;

PROCEDURE Command
Creates a user-defined procedure in a program file. There are two versions of the syntax.
PROCEDURE ProcedureName
Commands
RETURN
[ENDPROC]

By default, parameters are passed to procedures by value.

TECHNO INDIA GROUP Page No-112


BUSINESS SYSTEM Developed By Sangita Pal

When you issue the DO command with a procedure name, Visual FoxPro searches for the
procedure in the following order:

1. The file containing the DO command.

2. The current database.

3. Procedure files opened with SET PROCEDURE.

For more information, see SET PROCEDURE Command.

4. Program files in the execution chain.

Visual FoxPro searches program files in order from the most recently executed

program to the first program executed.

5. A standalone program file.

If a matching program file is found, Visual FoxPro executes the program. Otherwise,
Visual FoxPro generates an error message.

To execute a procedure in a specific file, include the IN clause in the DO command.


For information about use of the PROCEDURE command when creating classes, see
DEFINE CLASS Command.

QUIT Command
Ends the current Visual FoxPro session and returns control to the operating system.

Always use QUIT to terminate a Visual FoxPro session. If you turn the computer off
without issuing QUIT, open files might become damaged and data lost, and temporary
work files that would normally be deleted may be left on disk.

RECALL Command
Unmarks records marked for deletion in the selected table.
RECALL [FOR lExpression1] [WHILE lExpression2]

TECHNO INDIA GROUP Page No-113


BUSINESS SYSTEM Developed By Sangita Pal

You can use RECALL to recover records, provided you have not issued PACK or ZAP.
You can mark records for deletion by issuing DELETE or DELETE – SQL, or by
choosing Delete Records from the Table menu when a Browse or Edit window is active.
You can recall records by issuing RECALL, or by choosing Recall Records from the
Record menu when a Browse or Edit window is active.

RELEASE WINDOWS Command


Removes user-defined windows or Visual FoxPro system windows from memory.
RELEASE WINDOWS [WindowNameList]
RELEASE WINDOWS can be used to remove Visual FoxPro system windows from the
main Visual FoxPro window from or a parent, user-defined window.

The following list includes system windows that can be released from the main Visual
FoxPro window or from a parent window.
* Command
* Data Session (use RELEASE WINDOW "View")
* Debug
* Debug Output
* Document View
* Locals
* Trace
* Watch
* View

RELEASE PROCEDURE Command


Closes procedure files opened with SET PROCEDURE.
RELEASE PROCEDURE FileName1 [, FileName2 ...]

TECHNO INDIA GROUP Page No-114


BUSINESS SYSTEM Developed By Sangita Pal

Procedure files are opened with SET PROCEDURE. Once the file is open, the procedures
within the file are available to programs and from the Command window.
To close all open procedure files, issue SET PROCEDURE TO without any additional
arguments.

RELEASE Command
Removes variables and arrays from memory. There are several versions of the syntax.
RELEASE ALL

RENAME TABLE Command


Renames a table in the current database.
RENAME TABLE TableName1 TO TableName2

You cannot use RENAME TABLE to change the name of a free table; use RENAME
instead.

REINDEX Command
Rebuilds open index files.
REINDEX updates all index files open in the selected work area.

Index files become outdated when you open a table without opening its corresponding
index files and make changes to the index files' key fields. When index files become
outdated, you can update them by reindexing.

Visual FoxPro recognizes each index file type: compound index (.cdx) files, structural
.cdx files, and single index (.idx) files), and reindexes them accordingly. It updates all
tags in .cdx files and updates structural .cdx files, which automatically open with the
table.

RENAME Command
Changes the name of a file to a new name.

TECHNO INDIA GROUP Page No-115


BUSINESS SYSTEM Developed By Sangita Pal

Note
Do not use RENAME to change the name of a table in a database; RENAME does not
change the name of the table in the database. Instead, use RENAME TABLE to change
the name of a table in a database.
RENAME FileName1 TO FileName2

REPLACE Command
Updates table records.
REPLACE FieldName1 WITH Expression1 [, FieldName2 WITH eExpression2] ... [FOR
lExpression1] [WHILE Expression2]

REPLACE replaces data in a field with the value in an expression. Fields in unselected
work areas must be prefaced with their alias.

REPORT FORM Command


Displays or prints a report specified by a report definition (.frx) file, for example, created
with the CREATE REPORT or MODIFY REPORT command.

The REPORT FORM command can interpret Visual FoxPro label files (lbx format) as
well as report files. You can also use REPORT FORM to run character-based report files
created in FoxPro for MS-DOS.
RESTORE FROM Command
Retrieves variables and variable arrays saved in a variable file or a memo field and places
them into memory.
RESTORE FROM FileName

RESUME Command
Continues execution of a suspended program.
Use SUSPEND to suspend program execution. The suspended program restarts at the line
where execution was suspended.

TECHNO INDIA GROUP Page No-116


BUSINESS SYSTEM Developed By Sangita Pal

SUSPEND and RESUME are valuable debugging tools. You can suspend a program to
examine the current status of the Visual FoxPro environment, including memory
variables, window, menu bar, or menu definitions.

RETURN Command
Returns program control to a calling program.
RETURN terminates execution of a program, procedure, or function and returns control
to the calling program, the highest-level calling program, another program, or the
Command window.

Visual FoxPro releases PRIVATE variables when RETURN is executed.


RETURN is usually placed at the end of a program, procedure, or function to return
control to a higher-level program. However, an implicit RETURN is executed if you omit
RETURN.

RETRY Command
Executes the last command from the memory stack and then returns control to the calling
program. RETRY is similar to RETURN, except RETURN executes the next line in the
calling program.

RETRY is useful in error-handling routines. It is frequently used to execute a command


until a record- or file-locking function succeeds in locking the record or file. You can use
SET REPROCESS to control retries of a record- or file-locking function. SET
REPROCESS is preferable in most network situations.

RESTORE WINDOW Command


Restores to memory window definitions and window statuses saved to a window file or
memo field.

RESTORE WINDOW WindowNameList | ALL FROM FileName

TECHNO INDIA GROUP Page No-117


BUSINESS SYSTEM Developed By Sangita Pal

Use SAVE WINDOW to store window definitions in a window file or in a memo field.
Any windows in memory with the same names as those restored are overwritten. A
window's status (hidden, active, and so on) when it is saved is preserved when it is
restored.

RUN | ! Command
Executes external operating commands or programs.
RUN [/N] WindowsCommand | ProgramName
You can issue RUN from within the Command window or from within a program.

SAVE SCREEN Command


Saves an image of the main Visual FoxPro window or an active user-defined window to
the screen buffer, a variable, or an array element.
SAVE SCREEN [TO VarName]

Use RESTORE SCREEN to redisplay images saved to the screen buffer, a variable, or an
array element.

SAVE TO Command
Stores current variables and arrays to a variable file or memo field.
To place variables and arrays back into memory from a variable file or memo field, use
the RESTORE FROM command.

SCAN ... ENDSCAN Command


Moves the record pointer through the currently selected table and executes a block of
commands for each record that meets the specified conditions.

SCAN [FOR lExpression1] [WHILE lExpression2]


[Commands]
[LOOP]
[EXIT]
ENDSCAN

TECHNO INDIA GROUP Page No-118


BUSINESS SYSTEM Developed By Sangita Pal

SCAN automatically advances the record pointer to the next record that meets the
specified conditions and executes the block of commands.

You can place comments after ENDSCAN on the same line. The comments are ignored
during program compilation and execution.

SCAN ... ENDSCAN ensures that, upon reaching ENDSCAN, Visual FoxPro reselects
the table that was current when the SCAN ... ENDSCAN loop began.

SCATTER Command
Copies data from the current record to a set of variables, to an array, or an object.

SCATTER and COPY TO ARRAY behave similarly. SCATTER copies only a single and
current record into an array or a set of variables and automatically creates the array or
variables if they do not already exist. COPY TO ARRAY copies multiple records into an
array. To copy variables or array elements to table records, use the GATHER Command.

SEEK Command
Searches a table for the first occurrence of a record whose index key matches a general
expression, then moves the record pointer to the matching record.

You can use SEEK only with indexed tables, and you can search only on the index key.
The match must be exact unless SET EXACT is set to OFF.

If SEEK finds a record with a matching index key, RECNO( ) returns the record number
of the matching record, FOUND( ) returns true (.T.), and EOF( ) returns false (.F.).

If a matching key isn't found, RECNO( ) returns the number of records in the table plus 1,
FOUND( ) returns false (.F.), and EOF( ) returns true (.T.).

TECHNO INDIA GROUP Page No-119


BUSINESS SYSTEM Developed By Sangita Pal

SET Command Overview

The SET command performs different operations when used with various keywords.
SET [ [SetCommand] [ON | OFF]

When no arguments are passed, SET opens the Data Session window. The Data Session
window provides an easy way to open tables, establish relations, or change different
Microsoft Visual FoxPro settings.

SET ALTERNATE Command


Directs screen or printer output created with the ?, ??, DISPLAY, or LIST commands to a
text file.

SET ANSI Command


Determines how comparisons between strings of different lengths are made with the =
operator in Visual FoxPro SQL commands.

SET ASSERTS Command


Specifies if ASSERT commands are evaluated or ignored.

SET AUTOINCERROR Command


Specifies whether attempts to update values in a field using autoincrementing generate an
error or fail silently and proceed.

SET AUTOSAVE Command


Determines whether Visual FoxPro flushes data buffers to disk when you exit a READ or
return to the Command window.

SET BELL Command


Turns the computer bell on or off and sets the bell attributes.

TECHNO INDIA GROUP Page No-120


BUSINESS SYSTEM Developed By Sangita Pal

SET BLOCKSIZE Command


Specifies how Visual FoxPro allocates disk space for the storage of memo fields.

SET BROWSEIME Command


Specifies if the Input Method Editor is opened when you navigate to a text box in a
Browse window.

SET CARRY Command


Determines whether Visual FoxPro carries data forward from the current record to a new
record created with INSERT, APPEND, and BROWSE.

SET CENTURY Command


Determines whether Microsoft Visual FoxPro displays the century portion of date
expressions and how Visual FoxPro interprets dates that specify only 2 digit years.

SET CLASSLIB Command


Opens a visual class library (.vcx) containing class definitions.

SET CLOCK Command


Determines whether Visual FoxPro displays the system clock and specifies the clock
location on the main Visual FoxPro window.

SET COLLATE Command


Specifies a collation sequence for character fields in subsequent indexing and sorting
operations.

SET COLOR OF SCHEME Command


Specifies the colors of a color scheme or copies one color scheme to another color
scheme.

TECHNO INDIA GROUP Page No-121


BUSINESS SYSTEM Developed By Sangita Pal

SET COLOR SET Command


Loads a previously defined color set.

SET COMPATIBLE Command


Controls compatibility with Microsoft FoxBASE+ and other FoxPro languages.

SET CONFIRM Command


Specifies whether the user can exit a text box by typing past the last character in the text
box.

SET CONSOLE Command


Enables or disables output to the main Visual FoxPro window or to the active user-
defined window from within programs.

SET COVERAGE Command


Turns code coverage on or off, or specifies a text file to which code coverage information
is directed.

SET CPCOMPILE Command


Specifies the code page for compiled programs.

SET CPDIALOG Command


Specifies whether the Code Page dialog box is displayed when a table is opened.

SET CURRENCY Command


Defines the currency symbol and specifies its position in the display of numeric,
currency, float, and double expressions.

SET CURSOR Command


Determines whether the insertion point is displayed when Visual FoxPro waits for input.

TECHNO INDIA GROUP Page No-122


BUSINESS SYSTEM Developed By Sangita Pal

SET DATABASE Command


Specifies the current database.

SET DATASESSION Command


Activates the specified form's data session.

SET DATE Command


Specifies the format for the display of Date and DateTime expressions.

SET DEBUG Command


Included for backward compatibility. Makes the Debug and Trace windows either
available or unavailable from the Visual FoxPro menu system in versions prior to 5.0.

SET DEBUGOUT Command


Directs debugging output to a file.

SET DECIMALS Command


Specifies the number of decimal places displayed in numeric expressions.

SET DEFAULT Command


Specifies the default drive and directory.

SET DELETED Command


Specifies whether Visual FoxPro processes records marked for deletion and whether they
are available for use in other commands.

SET DEVELOPMENT Command


Causes Visual FoxPro to compare the creation date and time of a program with those of
its compiled object file when the program is run.

TECHNO INDIA GROUP Page No-123


BUSINESS SYSTEM Developed By Sangita Pal

SET DEVICE Command


Directs output from @ ... SAY to the screen, a printer, or a file.

SET DISPLAY Command


Included for backward compatibility.

SET DOHISTORY Command


Included for backward compatibility.

SET ECHO Command


Opens the Trace window for program debugging. Included for backward compatibility.

SET ENGINEBEHAVIOR Command


Enables SQL data engine compatibility with Visual FoxPro 7.0, 8.0, or 9.0.

SET ESCAPE Command


Determines whether pressing the ESC key interrupts program and command execution.

SET EVENTLIST Command


Specifies events to track in the Debug Output window or in a file specified with SET
EVENTTRACKING.

SET EVENTTRACKING Command


Turns event tracking on or off or specifies a text file to which event tracking information
is directed.

SET EXACT Command


Specifies the rules Visual FoxPro uses when comparing two strings of different lengths.

TECHNO INDIA GROUP Page No-124


BUSINESS SYSTEM Developed By Sangita Pal

SET EXCLUSIVE Command


Specifies whether Visual FoxPro opens table files for exclusive or shared use on a
network.

SET FDOW Command


Specifies the first day of the week.

SET FIELDS Command


Specifies which fields in a table can be accessed.

SET FILTER Command


Specifies a condition that records in the current table must meet to be accessible.

SET FIXED Command


Specifies if the number of decimal places used in the display of numeric data is fixed.

SET FULLPATH Command


Specifies if CDX( ), DBF( ), MDX( ), and NDX( ) return the path in a file name.

SET FUNCTION Command


Assigns an expression (keyboard macro) to a function key or key combination.

SET FWEEK Command


Specifies the requirements for the first week of the year.

SET HEADINGS Command


Determines whether column headings are displayed for fields and whether file
information is included when TYPE is issued to display the contents of a file.

TECHNO INDIA GROUP Page No-125


BUSINESS SYSTEM Developed By Sangita Pal

SET HELP Command


Enables or disables Microsoft Visual FoxPro online Help or specifies a Help file.

SET HOURS Command


Sets the system clock to a 12- or 24-hour time format.

SET INDEX Command


Opens one or more index files for use with the current table.

SET KEY Command


Specifies access to a range of records based on their index keys.

SET KEYCOMP Command


Controls Visual FoxPro keystroke navigation.

SET LIBRARY Command


Opens an external API (application programming interface) library file.

SET LOCK Command


Enables or disables automatic file locking in certain commands.

SET LOGERRORS Command


Determines whether Visual FoxPro sends compilation error messages to a text file.

SET MACKEY Command


Specifies a key or key combination that displays the Macro Key Definition dialog box.

SET MARGIN Command


Sets the left printer margin and affects all output directed to the printer.

TECHNO INDIA GROUP Page No-126


BUSINESS SYSTEM Developed By Sangita Pal

SET MARK OF Command


Specifies a mark character for menu titles or menu items, or displays or clears the mark
character.

SET MARK TO Command


Specifies a delimiter for the display of date expressions.

SET MEMOWIDTH Command


Specifies the displayed width of memo fields and character expressions.

SET MESSAGE Command


Defines a message for display in the main Visual FoxPro window or in the graphical
status bar, or specifies the location of messages for user-defined menu bars and menu
commands.

SET MULTILOCKS Command


Determines whether you can lock multiple records using LOCK( ) or RLOCK( ).

SET NEAR Command


Determines where the record pointer is positioned after FIND or SEEK unsuccessfully
searches for a record.

SET NOCPTRANS Command


Prevents translation to a different code page for selected fields in an open table.

SET NOTIFY Command


Enables or disables the display of certain system messages.

TECHNO INDIA GROUP Page No-127


BUSINESS SYSTEM Developed By Sangita Pal

SET NULL Command


Determines how null values are supported by the ALTER TABLE, CREATE TABLE and
INSERT - SQL commands.

SET NULLDISPLAY Command


Specifies the text displayed for null values.

SET ODOMETER Command


Specifies the reporting interval of the record counter for commands that process records.

SET OLEOBJECT Command


Specifies whether Visual FoxPro searches the OLE Registry when an object cannot be
located.

SET OPTIMIZE Command


Enables or disables Rushmore Query Optimization.

SET ORDER Command


Designates a controlling index file or tag for a table.

SET PALETTE Command


Specifies whether the Visual FoxPro default color palette is used.

SET PATH Command


Specifies a path for file searches.

SET PDSETUP Command


Loads a printer driver setup or clears the current printer driver setup.

TECHNO INDIA GROUP Page No-128


BUSINESS SYSTEM Developed By Sangita Pal

SET POINT Command


Determines the decimal point character used in the display of numeric and currency
expressions.

SET PRINTER Command


Enables or disables output to the printer, or routes output to a file, port, or network
printer.

SET PROCEDURE Command


Opens a procedure file.

SET READBORDER Command


Determines whether borders are placed around text boxes created with @ ... GET.

SET REFRESH Command


Determines whether and how often a Browse window is updated with changes made to
records by other users on the network.

SET RELATION Command


Establishes a relationship between two open tables.

SET RELATION OFF Command


Breaks an established relationship between the parent table in the currently selected work
area, and a related child table.

SET REPORTBEHAVIOR Command


Specifies the kind of report engine processing Visual FoxPro uses when executing
traditional REPORT FORM and LABEL commands.

TECHNO INDIA GROUP Page No-129


BUSINESS SYSTEM Developed By Sangita Pal

SET REPROCESS Command


Specifies how many times and for how long Visual FoxPro attempts to lock a file or
record after an unsuccessful locking attempt.

SET RESOURCE Command


Updates or specifies a resource file.

SET SAFETY Command


Determines whether Visual FoxPro displays a dialog box before overwriting an existing
file, or whether table or field rules, default values, and error messages are evaluated when
changes are made in the Table Designer or with ALTER TABLE.

SET SECONDS Command


Specifies whether seconds are displayed in the time portion of a DateTime value.

SET SEPARATOR Command


Specifies the character used to separate each group of three digits to the left of the
decimal point in displaying numeric and currency expressions.

SET SKIP Command


Creates a one-to-many relationship among tables.

SET SKIP OF Command


Enables or disables a menu, menu bar, menu title, or menu item for user-defined menus or
the Microsoft Visual FoxPro system menu.

SET SPACE Command


Determines whether a space is displayed between fields or expressions when you use the
? or ?? command.

TECHNO INDIA GROUP Page No-130


BUSINESS SYSTEM Developed By Sangita Pal

SET SQLBUFFERING Command


Determines whether data in a SQL SELECT statement is based on buffered data or data
written to disk.

SET STATUS Command


Displays or removes the character-based status bar.

SET STATUS BAR Command


Displays or removes the graphical status bar.

SET STEP Command


Opens the Trace window and suspends program execution for debugging.

SET STRICTDATE Command


Specifies if ambiguous Date and DateTime constants generate errors.

SET SYSFORMATS Command


Specifies whether Visual FoxPro for Windows system settings are updated with the
current Microsoft Windows system settings.

SET SYSMENU Command


Enables or disables the Visual FoxPro system menu bar during program execution, and
allows you to reconfigure it.

SET TABLEPROMPT Command


Enables or disables file open dialog from appearing when table cannot be located during
execution of a data command such as SELECT - SQL Command.

TECHNO INDIA GROUP Page No-131


BUSINESS SYSTEM Developed By Sangita Pal

SET TABLEVALIDATE Command


Specifies the level of table validation to perform.

SET TALK Command


Determines whether Visual FoxPro displays command results.

SET TEXTMERGE Command


Enables or disables the evaluation of fields, variables, array elements, functions, or
expressions that are surrounded by text-merge delimiters, and lets you specify text-merge
output.

SET TEXTMERGE DELIMITERS Command


Specifies the text-merge delimiters.

SET TOPIC Command


Specifies the Help topic or topics to open when you invoke the Visual FoxPro Help
system.

SET TOPIC ID Command


Specifies the Help topic to display when you invoke the Visual FoxPro Help system. The
Help topic is based on the topic's context ID.

SET TRBETWEEN Command


Enables or disables tracing between breakpoints in the Trace Window.

SET TYPEAHEAD Command


Specifies the maximum number of characters that can be stored in the type-ahead buffer.

TECHNO INDIA GROUP Page No-132


BUSINESS SYSTEM Developed By Sangita Pal

SET UDFPARMS Command


Specifies if Microsoft Visual FoxPro passes parameters to a user-defined function (UDF)
by value or by reference.

SET UNIQUE Command


Specifies whether records with duplicate index key values are maintained in an index file.

SET VARCHARMAPPING Command


Controls mapping of Character expressions to Varchar data types in result sets of queries
and views.

SET VIEW Command


Opens or closes the Data Session window or restores the Visual FoxPro environment
from a view file.

SKIP Command
Moves the record pointer forward or backward in a table.
SKIP [nRecords]
If the table has a master controlling index tag or index file, SKIP moves the record
pointer to the record determined by the index sequence.

SORT Command
Sorts records in the currently selected table and outputs the sorted records to a new table.
SORT TO TableName ON FieldName1 [ASCENDING | DESCENDING]
[FOR lExpression1] [WHILE lExpression2]

One or more specified fields in the current table determine the order in which the records
appear in the new table.

Character-type fields that contain numbers and spaces might not sort in the order you
expect. Numeric fields fill from right to left, with empty spaces to the left. In contrast,
character fields fill from left to right, with empty spaces to the right.

TECHNO INDIA GROUP Page No-133


BUSINESS SYSTEM Developed By Sangita Pal

For example, if two records in a table contain a character field with 1724 in one record
and 18 in the other, and the table is sorted on this field in ascending order, the record
containing 1724 appears before the record containing 18. This is because Visual FoxPro
reads each character in the character fields from left to right, and because 17 (in 1724) is
less than 18 (in 18), it puts 1724 first. To avoid this problem, always precede lower
numbers with leading zeros (0018) or make the field numeric.

STORE Command
Stores data to a variable, to an array, or to an array element.

STORE eExpression TO VarNameList


An alternative to STORE is the equal sign (=) assignment operator. The variable, array, or
array element must be on the left side of the equal sign and its value on the right side.
Dates can be stored directly to variables, arrays, or array elements by using braces

SUM Command
Totals all or specified numeric fields in the currently selected table.
SUM [ExpressionList] [FOR lExpression1] [WHILE lExpression2]

SUSPEND Command
Pauses program execution and returns to interactive Visual FoxPro.
While a program is paused, you can execute intervening commands, check variable
values, open the Trace and Debug windows, and so on.

All variables created while the program is paused are PRIVATE.


Use RESUME to restart execution of a suspended program. Program execution continues
with the line following the line containing SUSPEND.

TECHNO INDIA GROUP Page No-134


BUSINESS SYSTEM Developed By Sangita Pal

TEXT ... ENDTEXT Command


Sends lines of text specified by TextLines to the current output device or memory
variable. Visual FoxPro sends lines of text to the current output device until it encounters
an ENDTEXT statement or until the program ends.

The current output device can include the main Visual FoxPro window, a user-defined
window, a printer, a text file, or a low-level file.

By default, TEXT ... ENDTEXT sends output to the main Visual FoxPro window or the
active window. To suppress output to the main Visual FoxPro window or the active
window, issue SET CONSOLE OFF. To send output to a printer or a text file, use SET
PRINTER.

TOTAL Command
Computes totals for numeric fields in the currently selected table.
TOTAL TO TableName ON FieldName [FOR lExpression1] [WHILE lExpression2]
The table in the currently selected work area must be sorted or indexed. A separate total is
calculated for each set of records with a common field value or unique index key value.

The results are placed into records in a second table. One record is created in the second
table for each common field value or unique index key value.

Numeric overflow can occur if the numeric fields in the second table are not wide enough
to contain the totals. Visual FoxPro conserves the most significant portions of the totals
when numeric overflow occurs. When a field is too small to accept a total:

* Decimal places are truncated, and the remaining decimal portion of the total is
rounded.
* If the total still does not fit, scientific notation is used if the total field contains seven
or more digits.
* Finally, asterisks replace the field contents.

TECHNO INDIA GROUP Page No-135


BUSINESS SYSTEM Developed By Sangita Pal

TYPE Command

Displays the contents of a file.


TYPE FileName1
TYPE displays the contents of files. This display can be directed to the main Visual
FoxPro window, the active user-defined window, a printer, or another file.

When SET HEADINGS is ON, Visual FoxPro inserts a form feed, the path and name of
the file, and the date at the beginning of output produced with TYPE. If SET HEADINGS
is OFF, this information isn't included.

In FoxPro for MS-DOS, if a printer driver setup is loaded and you direct output from
TYPE to a file or a printer, TYPE displays the file contents using the settings from the
printer driver setup.

UNLOCK Command
Releases a record lock, multiple record locks, or a file lock from a table, or releases all
record and file locks from all open tables.
UNLOCK [RECORD nRecordNumber] [ALL]

Record and file locks can be removed from a table only by the user who issued the locks.
UNLOCK cannot unlock a table opened for exclusive use.

A record lock (or locks) or a file lock is released from the table in the current work area if
you issue UNLOCK without any additional arguments.

USE Command
Opens a table and its associated index files or opens a SQL view.
USE [DatabaseName] TableName

TECHNO INDIA GROUP Page No-136


BUSINESS SYSTEM Developed By Sangita Pal

If you issue USE without a table name, and a table file is open in the currently selected
work area, Visual FoxPro closes the table. Visual FoxPro also closes a table when another
table is opened in the same work area. You cannot have more than one table open in a
work area at one time.

When used with a non current database, the USE command opens the database
automatically but does not set the database as the current database. When the table closes,
the database remains open.

VALIDATE DATABASE Command


Ensures that the locations of tables and indexes in the current database are correct.

WAIT Command
Displays a message and pauses Visual FoxPro execution until the user presses a key or
clicks the mouse.
WAIT [MessageText] [TIMEOUT nSeconds]

If a WAIT message is displayed in Visual FoxPro for Windows, pressing the SHIFT or
CTRL keys hides all windows including the WAIT message.

WITH ... ENDWITH Command


Specifies multiple properties for an object.
WITH ObjectName [AS <Type>]
[cStatements]
ENDWITH

WITH ... ENDWITH provides a convenient way to specify a number of properties for a
single object. Note that you can also execute methods from within a WITH ... ENDWITH
structure.

TECHNO INDIA GROUP Page No-137


BUSINESS SYSTEM Developed By Sangita Pal

ZAP Command
Removes all records from a table, leaving just the table structure.
Issuing ZAP is equivalent to issuing DELETE ALL followed by PACK, but ZAP is much
faster.

If SET SAFETY is ON, Microsoft Visual FoxPro asks if you would like to remove the
records from the current table.

TECHNO INDIA GROUP Page No-138


BUSINESS SYSTEM Developed By Sangita Pal

Tables in Visual FoxPro

Creating a New Table

A table is a collection of related records. Each attribute of a table is known as a "Field".


Each row of table is known as "Record". Before creating a table, the first step is to define
and design its structure. The structure defines how the information will be stored in a
table, that is, how many fields are there in the file and what type of information is stored
in each field. The structure also limits the length of data stored in each field.
To create a new table, choose any of the following methods:

♦ Using Menu System Select File » New, a New dialog box will appear as shown
below:

New Dialog Box


Choose Table/DBF option button.
♦ Using Command Window Command to create a new table is
CREATE <filename>.

TECHNO INDIA GROUP Page No-139


BUSINESS SYSTEM Developed By Sangita Pal

As soon as the above operation is performed, the Table Designer dialog box appears on
the screen.

Defining a Table Structure


The Table Designer dialog box has columns headed Name, Type, Width, Decimal, Index
and Null.

Field Name
When naming a field, use a name that best describes the contents of the field.
• Field name must be unique, and must begin with an alphabet.
• Field name may have up to ten characters including letters from A to Z, whole
numbers, and the underscore character and must not contain spaces.
For example,
Emp-Phone is an invalid field name because of the presence of hyphen sign.
Emp_Phone is valid field name.

TECHNO INDIA GROUP Page No-140


BUSINESS SYSTEM Developed By Sangita Pal

Field Types/Data Types

"Type" means the type of data that can be stored in the corresponding field. Visual
FoxPro allows 13 types of data to be stored in the fields. These are:

Character Type In this type of field, you can store any alphanumeric data. Numeric data
can also be stored in this type of field, but no numeric calculation can be done. A
maximum of 254 characters can be stored in a character-type field. To store this type of
data it needs 1 byte of data storage space for each character.

Currency Type This type of field is used to store monetary values. A maximum of 20
digits can be stored here including"+","-" and"." (Decimal point). To store this type of
data it needs 8 bytes of memory space.

Numeric Type Any numeric data can be stored in this type of field. A maximum of 20
digits can be stored here"+","-", and"." (Decimal point). It requires 8 bytes of memory
space to store this type of data.

Float Type This type of field is mainly required to store scientific data. A maximum of
20 digits including"+","-", and".") can be stored in this type of field. Eight bytes of
memory space is required to store this type of data.

Integer Type It can store only integer value. It needs 4 bytes of memory space to store
the data.

Date Type This type of field is used to store any type of date value. Default format for
storing date is "mm/dd/yy". The calculations related to date can be performed using this
type of field. Its acceptable range is from 01/01/100 to 12/31/9999. It requires 8 bytes of
memory space to store the data.

TECHNO INDIA GROUP Page No-141


BUSINESS SYSTEM Developed By Sangita Pal

Date Time Type In this type of field, date and time are stored simultaneously using a
default format "dd/min/yy/hh/mm/ss". Accepted range of date is from 01/01/100 to
12/31/9999, and acceptable range of time is 00:00:00 am to 11:59:59 pm. Eight bytes are
required to store this type of data.

Double Type This is also a type of numeric field but with double precision. Eight bytes of
memory space is required to store the data.

Logical Type In this type of field we can only store "True" and "False" value in the form
of "T" and "F". One byte of memory space is required to store the data.

Memo Type In this field, we can store any type of data having any volume. The amount
of data which can be stored in this type of field can be determined only by the available
size of memory. Default width of emp field is 4. The data stored in memo field is stored
in a separate file with same name as the table but has an extension .FPT.

General Type In this field, you can store any picture, graph and other types of data using
an OLE object. In the table structure it shows only 4 bytes but the data can be of any size
and is stored in a separate file.

Character (Binary) In this field, you can store any picture, graph and other types of data
using an OLE object. In the table structure it shows only 4 bytes but the data can be of
any size and is stored in a separate file.

Memo (Binary) Memo-field data you want to maintain can be stored in this type of field
without any change across code pages. It shows 4 bytes in table-structure dialog box but
any amount of data can be stored here because it is stored in a separate file and is only
dependent on the available memory.

TECHNO INDIA GROUP Page No-142


BUSINESS SYSTEM Developed By Sangita Pal

Creating a Table using Table Wizard

To create a new table using Table Wizard, follow the steps given below:
• Select File » New from the menu bar.
or
• Click at'New' icon on the Standard Toolbar.

or
• Press Ctrl+N.

On performing any of the above mentioned operations, a New dialog box appears on the
screen. Select Table from the "New" dialog box. And, then select "Wizard". Immediately
a Table Wizard dialog box appears. Table Wizard consists of a total of four steps.

TECHNO INDIA GROUP Page No-143


BUSINESS SYSTEM Developed By Sangita Pal

Step One — Select Fields In the first step of Table Wizard, user is required to design the
table structure. Screen for Step-1 of Table Wizard is shown below:
In the dialog box given above, select the type of table you want to create from Sample
Tables list box. And, then move the list of required fields from Available Fields list box
to Selected Fields.

Step la — Select a Database


Next step of wizard is a sub-step of Step 1 which asks you to select a database in which
you want to store your table (if required) otherwise, you can create your new table as a
stand-alone free table by selecting the radio button — Create My Table as a Stand-Alone
Free Table.

Step la of Table Wizard

After performing the above task, click on Next button to move


After making required modifications, move to the next step by pressing Next button.

TECHNO INDIA GROUP Page No-144


BUSINESS SYSTEM Developed By Sangita Pal

Step 2 – Modify Field Settings


Next step allows the user to modify the field settings if required modifications, move to
the next step by pressing Next button

Step 2 of Table Wizard

TECHNO INDIA GROUP Page No-145


BUSINESS SYSTEM Developed By Sangita Pal

Step 3 — Index the Table


Here, a table may be indexed on a field of user's choice if required.

Step 3 of Table Wizard

Press Next to move to the next step.

Step 4 — Finish
This is the last step of Table Wizard. Here, you are provided with three options:
• Save Table for later use.
• Save Table and browse it.
• Save Table and modify it in the Table Designer.
Select the appropriate option.

TECHNO INDIA GROUP Page No-146


BUSINESS SYSTEM Developed By Sangita Pal

Step 4 of Table Wizard

Finally, to exit from the wizard, click on "Finish" button.

Saving a New Table


After defining the database structure:
• Click OK button
or
• Press Ctrl+W

After saving the file, a dialog box appears asking about additions to the table. If you want
to add records to the table, select Yes otherwise select No.

Saving an Existing Table


You need to save the table every time a modification is made on the table. You can use
any of the given methods to save the table:
• Select File » Save
or
• Press Ctrl+W

TECHNO INDIA GROUP Page No-147


BUSINESS SYSTEM Developed By Sangita Pal

Closing a Table
Normally, only one database file can be in use at a time. More than one table can be
opened using the SELECT command.
If another table is opened, the current file will no longer be in use, that is, current file is
automatically closed.

To close an open table:


Enter CLOSE DATABASES in the Command window.
or
Choose File » Close.

Opening a Table
To open an existing table, choose either of the following methods:
Enter USE <filename> in the Command window.
or
Choose File » Open.

Viewing Contents of a Table


After adding records to the table, the next logical step is to view the data. List and
Display are the two very useful commands for viewing the data.

List
Displays the contents of all or selected records on the screen, prints or stores it in a disk
file from the currently selected table.

Syntax
LIST [FIELDS field list] [FOR <expl1>] [While <exp12>

TECHNO INDIA GROUP Page No-148


BUSINESS SYSTEM Developed By Sangita Pal

Arguments

All To specify all records.

NEXT<n> Specify range of records beginning with current record and

continuing for specified number <n> of records.

REST Specify all the records beginning with current record and ending

with last record in file.

Record<n> Specify the record number of the record <n> on which command

will act.

FIELDS field list By default, all fields from the table are displayed. Field list

includes only those field names which are to be displayed.

FOR<expll> FOR clause conditionally displays records, filtering out undesired

records. If included, only the records that satisfies

While <expl2> the logical condition <expll> are displayed. If WHILE clause is

included, records are displayed as long as the logical expression

<expl2> evaluates to T.

For example:

• List EMP_ROLL, EMP_NAME


Above is an example of selective fields listing, that is, we are displaying only two
fields—
EMP_ROLL, EMP_NAME from the current table.

• LIST OFF NEXT 5


Above is an example of listing only next five records including the current record?

TECHNO INDIA GROUP Page No-149


BUSINESS SYSTEM Developed By Sangita Pal

This is an example of conditional listing.

• LIST FOR EMP_SAL > 1000


• LIST FOR EMP_NAME = "RAJAN"
• LIST FOR EMP AGE>20 TO PRINTER

Examples of using logical operators in List command.

• LIST FOR EMP_SAL > = 1000 AND EMP_SAL < = 5000


• LIST FOR UPPER (EMP_NAME) = "ABC" AND EMP_AGE >= 20
• LIST FOR (EMP_AGE > 20 OR EMP_SAL <10000) and (y_pass >= 1975 and
y_pass <= 1990)

Examples of listing with logical fields.


• LIST FOR PAID
• LIST FOR PAID=.F.

Display
Displays a record from the current table.

Syntax
DISPLAY [scope] [FIELDS <fieldlist>] [FOR<expLl>] [WHILE <expL2>]

Example:
• DISPLAY
• DISPLAY NEXT 5 FOR DEPT = "COMPUTER"
• DISPLAY FIELDS EMPNAME, BASIC
• DISPLAY ALL

TECHNO INDIA GROUP Page No-150


BUSINESS SYSTEM Developed By Sangita Pal

Note
• The main difference between LIST and DISPLAY is that, LIST command
displays all records by default whereas the default scope of DISPLAY is the
current record (Next 1).

• The similarity between the two occurs when DISPLAY is used with ALL option.
But again, LIST scrolls information continuously, whereas DISPLAY ALL pauses
whenever the screen becomes full.

Moving a Record Pointer (GO/GOTO)

FoxPro pointer is always pointing to some record whenever a table is in use. To move a
pointer to a specific record, GO/GOTO command can be used.

Syntax
GO /GOTO <TOP> <BOTTOM>
or
GO/GOTO[RECORD] <expn>
Arguments
TOP Pointer will be at the first record in the file.
B OTTOM Pointer will be at the last record in the file.
RECORD <expn> To move the pointer to the desired record number <expn>.

Examples:
GOTO 4 moves the record pointer to the 4th record of current table.
GO BOTTOM moves record pointer to the last record of current table.

TECHNO INDIA GROUP Page No-151


BUSINESS SYSTEM Developed By Sangita Pal

Browse
Opens the Browse window and displays records from current or selected table.

Syntax
BROWSE [FIELDS Fieldlist]
[FONT cFontname [, n Fontsize]]
[STYLE cfont-style]
[FOR expl [REST]]
[FORMAT] [FREEZE fieldname]
[Key eLow [, eHigh]]
[LOCK n number of fields]
[NAMEObjectname]
[NOAPPEND] [NODELETE]
[NOEDIT INOMODIFY] [NOMENU] [NOWAIT]

Arguments
FOR expll
Specifies a condition whereby only records for which logical expression expl 1 is True
are displayed in BROWSE window.

REST
Prevents record pointer from being moved from its current position to the top of the table
when BROWSE window is opened with FOR clause. Otherwise, Browse positions the
record pointer at the top of the table by default.

FORMAT
Specifies use of a format file to control the display and data-entry format in a Browse
window. Format file must be opened with SET FORMAT. Format file can include the
following:

TECHNO INDIA GROUP Page No-152


BUSINESS SYSTEM Developed By Sangita Pal

Adding Data to Table


New records can be added to an existing table. Records are always placed at the end of
the current table. Data can be added to a table using the Append command.

Append
Adds one or more new records to the end of a table.

Syntax
Append [BLANK] [IN nWORKAREA IcAlias] [No MENU]

Arguments:

Blank
Adds one blank record to the end of the current table. Visual FoxPro does not open an
editing window when you issue Append Blank. You can edit the new record with Edit,
Change, or Browse.

IN nWorkArea
Specifies the work area of the table to which a new record is appended.

Append From
Adds records to the end of the currently selected table from another file.

Syntax
APPEND FROM FILENAME [FIELDS fieldlist] [FOR expl]

Arguments:
• Filename
Specifies the name of the file to append from. Visual FoxPro assumes a default extension
.dbf when no extension is mentioned with filename.
• ?
Displays Open dialog box, from which you can choose a table to append from.

TECHNO INDIA GROUP Page No-153


BUSINESS SYSTEM Developed By Sangita Pal

For example:
APPEND FROM EMP FOR SAL > 1000

Deleting Records
There are three commands to delete unwanted records from the table permanently or
temporarily. Delete, Pack, and Zap

Delete
Marks records for deletion. Records marked for deletion are not physically removed from
the table until PACK is issued.

Syntax
DELETE [Scope] [FOR<expll>] [WHILE <expl2>]

Arguments:
♦ Scope
Scope clause can include ALL, NEXT <n>, REST, RECORD <n>. Default scope of
DELETE is NEXT1.

For example:
DELETE NEXT 5
DELETE FOR ROLL > 200

Notes
• Browse, Edit or Change can also be used for deletion purpose.
• A function DELETED() is used to return logical value that indicates whether
current record is marked for deletion.

For example:
LIST FOR DELETED()

TECHNO INDIA GROUP Page No-154


BUSINESS SYSTEM Developed By Sangita Pal

Pack
Permanently removes all records marked for deletion in current table and reduces size of
a memo file associated with the table.

Syntax
PACK [MEMO] [DBF]

Arguments:
♦ Memo
Removes unused space from memo file but does not remove records marked for deletion
from the table.
♦ DBF
Removes records marked for deletion from the table but does not affect the memo file.

When PACK command is issued, Visual FoxPro copies all records not marked for
deletion to a temporary table. After PACK has finished executing, Visual FoxPro deletes
the original table from disk and renames the temporary table with original table's name. If
Esc is pressed in between, then PACK is interrupted and temporary table is deleted
leaving original table unaffected. Original table is also recovered if you run out of disk
space while PACK is executing. When PACK is issued without any argument
(MEMO/DBF), PACK affects both the table and memo file. PACK requires exclusive use
of table. If current table has one or more indexes open, PACK rebuilds the index file. Be
careful to mark only those records that are of no use. There is no way to retrieve deleted
records after using PACK.

Zap

Removes all records from a table, leaving just the table structure intact. This command is
equivalent to DELETE ALL followed by PACK.

TECHNO INDIA GROUP Page No-155


BUSINESS SYSTEM Developed By Sangita Pal

Syntax
ZAP [IN nWorkArea / cAlias]

If you omit nWorkArea and cAlias, all records are removed from the table in current
selected work area. Records zapped from the current table cannot be recalled.

Recall
Unmarked records marked for deletion in selected table.

Syntax
RECALL [Scope] [FOR<expll>] [WHILE <expl2>]
Default scope of RECALL is NEXT1.
You can use RECALL to recover records, provided PACK or ZAP has not been issued.

Example:
• RECALL ALL
• RECALL ALL FOR SAL > 10000

Replace
Updates table records. Default scope of REPLACE is ALL.

Syntax
REPLACE fieldname1 WITH expl [, fieldname2 WITH exp2] ... [FOR expl1]
[WHILE expl2]

For example:
REPLACE E_SAL WITH E_SAL + 100
Modify Structure Command

Displays Table Designer, allowing you to modify the structure of a table.

TECHNO INDIA GROUP Page No-156


BUSINESS SYSTEM Developed By Sangita Pal

Syntax
MODIFY STRUCTURE
NOTE

Changing a field from one data type to another may not transfer the contents of the field
correctly, or at all. For example, if you convert a field of date type to numeric type, field
contents do not transfer.

Display Structure Command


Displays structure of a table file.

Syntax
DISPLAY STRUCTURE

TECHNO INDIA GROUP Page No-157


BUSINESS SYSTEM Developed By Sangita Pal

What is a Query?

According to the American Heritage Dictionary, a Query is a question, or we can say that
it is an inquiry. So when you query a database, you are asking it questions about data.
Using an employee file, you might ask the following questions:

• Total number of employees.


• A list of all those employees whose Basic Salary > 1,000.
• List of all those employees whose age <50.
• List of all employees who are about to retire from their jobs in the current year.

With a little effort, you can come up with infinite questions. Both Queries and Views are
built in order to answer such type of questions.

Query: A request for information from a database.

There are three general methods for posing queries:


1) Choosing parameters from a menu: In this method, the database system
presents a list of parameters from which you can choose. This is perhaps the
easiest way to pose a query because the menus guide you, but it is also the least
flexible.

2) Query by example (QBE): In this method, the system presents a blank record and
lets you specify the fields and values that define the query.

3) Query language: Many database systems require you to make requests for
information in the form of a stylized query that must be written in a special query
language. This is the most complex method because it forces you to learn a
specialized language, but it is also the most powerful.

TECHNO INDIA GROUP Page No-158


BUSINESS SYSTEM Developed By Sangita Pal

Query Wizard: The Query Wizard provides an easy one to five step selection and
recovery of features and their attributes for display as maps, graphs, or animations. The
actual steps involved in a particular Query will depend on the Feature Types selected and
whether or not they have attributes, temporal and/or depth components associated with
them.

The possible steps in the Query Wizard are:

Step 1 - Select Fields

Use the Databases and Tables controls to locate and select the table you want to use.
In the Available fields window, select three or four fields you want to use from the
selected table, and use the arrow buttons to move them to the Selected fields window.

TECHNO INDIA GROUP Page No-159


BUSINESS SYSTEM Developed By Sangita Pal

Step 2 - Relate Tables


You can select matching fields from the field lists to determine the relationship between
tables or views.

Step 2a - Include Records

Limit your query by choosing only matching rows from both tables or all rows from
either table. By default, only matching records are included.

If you want to create an inner join, select only Matching Rows. If you want to create an
outer join, select all the records from one of the two tables.

Step 3 - Filter Records

You can reduce the number of records by creating expression that filters records from the
elected tables or views. You can create two expressions and connect them with AND or
OR. Choose Preview to see the records that will be returned based on supplied filter
criteria.

TECHNO INDIA GROUP Page No-160


BUSINESS SYSTEM Developed By Sangita Pal

Step 4 - Sort Records


Select up to three fields or an index tag to determine the order in which your results will
be sorted.

Step 4a - Limit Records


You can further limit the number of records in the View, based on either a percent of
records returned, or an actual number of records.

TECHNO INDIA GROUP Page No-161


BUSINESS SYSTEM Developed By Sangita Pal

Step 5 – Finish
After you save the Query, you can open and modify it like any other Query in Query
Designer.

Now, you have to type a name for the query and save the query. Run the query by right
clicking on it.

TECHNO INDIA GROUP Page No-162


BUSINESS SYSTEM Developed By Sangita Pal

QUERY DESIGNER

The Query Designer is a powerful tool for creating and editing profile queries,
intended for selecting or modifying table data.

The Query Designer window is divided into several tabs. The Designer tab is provided
for adding tables to the query and selecting the columns, included into the query. The
Options tab allows you to define various query properties, such as query name, type,
description, etc. The Conditions tab allows you to define the criteria for SELECT,
UPDATE, and DELETE queries. The Insert Values tab is intended for defining values in
INSERT queries. The Columns tab contains various properties of the selected query
columns: grouping and sorting for SELECT, or update values for UPDATE queries.

Creating a Query using Query Designer


To create a Query using Query Designer, select the table or view from where information
is to be retrieved, specify the criteria to extract records from the table or view, and then
direct results of the Query to the type of output required, such as a Browse window,
report, table, label, and so on. Queries are stored as files with .QPR extension.

Query Design Process

Step 1: Open Query Designer


Query designer can be opened by following any of the given methods:
Select File » New from the system menu or New button in Standard toolbar. A New
dialog box appears:

TECHNO INDIA GROUP Page No-163


BUSINESS SYSTEM Developed By Sangita Pal

New Dialog Box

Select Query and then press New file button. You can also open Query designer from the
command window by using Create Query <new filename OR Modify Query <new
filename>

Step 2: Adding a Table or View from a Database


A Query requires at least one table. Visual FoxPro does not assume that you want to
Query the table in current work area; hence, it immediately displays an Open dialog box
and enables you to select the first table.

Data can be retrieved from a single database (and if required even from different
databases)
with the help of Add Table or View dialog box.

TECHNO INDIA GROUP Page No-164


BUSINESS SYSTEM Developed By Sangita Pal

From the above dialog box if you want to open a free table (table independent of any
database) then press Other... push button.

♦ Immediately, Query Designer dialog box is opened.

Query Designer Dialog Box

TECHNO INDIA GROUP Page No-165


BUSINESS SYSTEM Developed By Sangita Pal

Upper-half of the Query Designer dialog box displays the name of the open table along
with its structure.

If you want to add more tables, then right-click anywhere in the empty area in upper-half
of the Query Designer dialog box. A pop-up appears.

Select Add Table... from pop-up.

Executing a Query

An existing Query can be executed by any of the given methods:


♦ Select Query » Run Query
or
♦ Use shortcut Ctrl+Q
or
♦ Use command Do <Queryfile>

TECHNO INDIA GROUP Page No-166


BUSINESS SYSTEM Developed By Sangita Pal

Adding a Comment to Your Query


If you want to identify your Query in some manner, or add notes about it, you can add
comments to your query that will help in identifying it and its purpose.

To add a comment to a query:


• Select Query » Comments
• In Comment box, type any notes you want to make about the Query.
• Choose OK.
NOTE
Notes
• Comments you enter appear at the top of SQL window, preceded by an asterisk.
• To see SQL code, select Query » View SQL or click "Show SQL Window" button
on Query Designer toolbar.

Modifying an Existing Query


An existing Query can be modified with the help of MODIFY QUERY command.
Syntax: MODIFY QUERY <filename>

TECHNO INDIA GROUP Page No-167


BUSINESS SYSTEM Developed By Sangita Pal

What is a Form?

Nearly every application or user utility that you write in Visual FoxPro will include at
least one form (and probably quite a few). Forms are the powerful descendants of pre-
Visual FoxPro screens and they serve as the primary points of user interaction with both
the underlying data and business logic in most applications.

Visual FoxPro Form is a container class, capable of holding any number of other controls
or containers such as text boxes, command buttons, check boxes, page frames, or grids.
Forms provide a rich set of objects (an instance of a class, combining both data and
procedures. For example, a control on a running form is an object that can respond to user
(or system) events (an action, recognized by an object, for which you can write code to
respond. Events can be generated by a user action such as clicking the mouse or pressing
a key by program code, or by the system, as with timers.) so that users could accomplish
their information management tasks as easily and as intuitively as possible.

Form Designer

Creating a New Form


You can create a new form with the help of Form Designer, and you can see how each
object will appear to the user as you design it.

To create a new form


In Project Manager, select Forms and choose NEW
OR
Select FILE »NEW »FORM and choose New file
OR
Use CREATE FORM <filename> command

TECHNO INDIA GROUP Page No-168


BUSINESS SYSTEM Developed By Sangita Pal

After you have created a new form Visual FoxPro launches Form Designer.

Form Designer

The most crucial elements of the Form Designer are the Form Canvas (the visual
representation of the form container), Properties Window (which shows all available
property, event and method (PEM) settings for the form and its controls) and the Form
controls toolbar (which makes available various controls that can be dropped onto the
canvas). The various toolbars are:

• Color Palette Toolbar This toolbar enables you to easily set the colors on a form and
any of its controls.

• Layout toolbar This toolbar provides the tools to properly align and size controls on
the form, modify the relative stacking order of overlapping objects and resize
controls.

TECHNO INDIA GROUP Page No-169


BUSINESS SYSTEM Developed By Sangita Pal

• Data Environment Window This window shows the specified elements of Form's
Data Environment.

• Code Window This window shows the code that has been added to any of the
methods or forms or its controls.

Form Wizard

Creates a form for data entry from a single table. The size of the form is based on your
Maximum design area setting on the Forms tab, Options dialog box.

To run the Form Wizard


• From the Wizards submenu on the Tools menu, choose Form.
• In the Wizard Selection dialog box, choose Form Wizard.

If you create a form within a database, the Form Wizard can use input mask and format
settings stored in the database. After you save the form, you can open and modify it later
like any other form in the Form Designer.

Step 1 - Select Fields

In this step, you can choose a free table or a table within a database as the source for your
pivot table. You can select only fields from a single table or view.

To select the fields for your cross-tab query


• Use the Databases and Tables controls to locate and select the table you want to
use.

• In the Available fields window, select three or four fields you want to use from the
selected table, and use the arrow buttons to move them to the Selected fields
window.

TECHNO INDIA GROUP Page No-170


BUSINESS SYSTEM Developed By Sangita Pal

You need to choose at least three fields; one each for row values, column values, and
data.

TECHNO INDIA GROUP Page No-171


BUSINESS SYSTEM Developed By Sangita Pal

Step 2 - Choose Form Style

In this step, you can specify form style and button type.

TECHNO INDIA GROUP Page No-172


BUSINESS SYSTEM Developed By Sangita Pal

Step 3 - Sort Records

In the Available fields window, select fields you want to use from the selected table, and
use the add> buttons to move them to the Selected fields window.

TECHNO INDIA GROUP Page No-173


BUSINESS SYSTEM Developed By Sangita Pal

Step 4 – Finish

In this step, you have to type a title for the form and save the form for later use. Run the
form by right clicking on the form.

Assigning Icons to Forms

In Visual FoxPro for Windows, you can assign an icon to the form; the icon is displayed
when the window is minimized in Windows NT and in the title bar in Windows 95. To
assign an icon to a form, set the form's Icon property to the name of an .ico file.

To assign an icon to a form:


• Open the form
• Open the Properties window
• Set the Icon property to the .ico file that you want to display.

TECHNO INDIA GROUP Page No-174


BUSINESS SYSTEM Developed By Sangita Pal

Saving Forms

You need to save your form before you can run it. If you try to close the Form Designer
when the form has not been saved, Visual FoxPro prompts you to save or discard the
changes you've made.

In the Form Designer, choose Save from the File menu.

Saving Forms and Controls as Classes

You can also save a form, or a subset of the controls on a form, as a class definition. If
you intend to create subclasses based on the form or reuse the controls in other forms,
save the form as a class definition.

To save a form or selected controls as a class definition


• From the File menu, choose Save As Class.
• In the Save As Class dialog box, choose Current form or Selected controls.
• In the Name box, enter a name for the class.
• In the File box, enter a filename for the class to be stored to.
• Choose OK.

If you don't give the filename an extension, the default extension of .vex is added when
the file is saved. Once a form has been saved as a class definition, you can modify it with
the MODIFY CLASS command.

Running a Form
You can run a form directly from the interface or in program code.

Running a Form Interactively


There are several ways to run the form you've designed. If you're working in the Form
Designer, you can test the form by clicking the Run button on the Form Designer toolbar.

TECHNO INDIA GROUP Page No-175


BUSINESS SYSTEM Developed By Sangita Pal

To re-open the form in the Form Designer, close the form or choose the Modify Form
button on the toolbar.

You can also run a form from a project or programmatically.

To run a form interactively:

• In the Project Manager, select the form and choose Run.


or
• Type DO FORM in the Command window.

You can also run the form by choosing Do from the Program menu, choosing Form
in the List Files of Type box, selecting the form, and choosing Do.

Running a Form from a Program

To programmatically run a form, include the DO FORM command in the code associated
with an event, in method code, or in a program or procedure.

TECHNO INDIA GROUP Page No-176


BUSINESS SYSTEM Developed By Sangita Pal

Report Wizard

It creates reports using one free table or one table or view in a database. The wizard
prompts you with simple questions as you go through a series of steps, in which you
specify the source and fields that you want to use to create controls on your report.

To run the Report Wizard

From the Wizards submenu on the Tools menu, choose Report.


In the Wizard Selection dialog box, choose Report Wizard.

TECHNO INDIA GROUP Page No-177


BUSINESS SYSTEM Developed By Sangita Pal

Report Wizard Steps

Step 1 - Select Fields


Use the Databases and Tables controls to locate and select the table you want to use.
In the Available fields window, select three or four fields you want to use from the
selected table, and use the
arrow buttons to move them to the Selected fields window.

Step 2 - Group Records


You can use data grouping to categorize and sort your records so that they are easier to
read. Once you select a field in one of the GROUP BY boxes, you can choose
GROUPING OPTIONS and SUMMARY OPTIONS to refine your grouping selection.

TECHNO INDIA GROUP Page No-178


BUSINESS SYSTEM Developed By Sangita Pal

Choosing GROUPING OPTIONS opens the GROUPING INTERVALS dialog box that
allows you to select levels of filtering that are relevant to the type of data contained in the
fields you selected for grouping.

Choosing SUMMARY OPTIONS opens a new dialog box that lets you specify from the
following list the type of calculation to perform on specific numeric fields:

• Sum Total of values in specified numeric field.


• Avg Average of the values in the specified numeric field.
• Count A count of the number of records containing a non-zero value in specified
field.
• Min Minimum value in specified numeric field.
• Max Maximum value in specified numeric field.

You can also choose Detail and Summary only, or No Totals for the report.
Fields that you select as groupings here are not available in step 5, that is, Sort Records

TECHNO INDIA GROUP Page No-179


BUSINESS SYSTEM Developed By Sangita Pal

Step 3 - Choose Report Style


• Executive
• Ledger
• Presentation
• Banded
• Casual

TECHNO INDIA GROUP Page No-180


BUSINESS SYSTEM Developed By Sangita Pal

Step 4 - Define Report Layout


Choose page orientation
• Portrait
• Landscape

TECHNO INDIA GROUP Page No-181


BUSINESS SYSTEM Developed By Sangita Pal

Step 5 - Sort Records

Select fields for sorting in ascending or descending order.

TECHNO INDIA GROUP Page No-182


BUSINESS SYSTEM Developed By Sangita Pal

Step 6 –Finish

Now, save the report for later use.


To see the report, chose print preview option from file menu.

Running a Report

To print a report:
• Select REPORT » RUN REPORT from the menu bar.
OR
• Use the command

TECHNO INDIA GROUP Page No-183


BUSINESS SYSTEM Developed By Sangita Pal

Report Designer

Report Designer can be used to create and modify reports. When the Report Designer window is
active, Visual FoxPro displays Report menu and Report Controls toolbar.

Creating a New Report


To create a new report, choose any of the given methods

• Choose FILE » NEW -> REPORT radio button -> NEW FILE push button

• From Project Manager, click Documents tab, select Report icon in the document list and
click on New button. Then select New Report.
OR

• From the command window, use


CREATE REPORT <newname>
or
MODIFY REPORT <newname>

Immediately, Visual FoxPro will launch the Report Designer.

TECHNO INDIA GROUP Page No-184


BUSINESS SYSTEM Developed By Sangita Pal

Report Designer has several components:

• Report Canvas is the visual representation of the report you are designing, the area onto
which you place fields, labels, or graphics.

• Report Designer toolbar enables you to have easy access to all the report toolbars and
several important functions.

• Report Controls toolbar enables you to drop any of six types of controls or objects onto
your report: labels, fields, lines, rectangles, rounded rectangles, and ActiveX/OLE

• Color palette toolbar enables you to specify colors for the background or foreground of
any control.

• Layout toolbar enables you to align or size one or more controls.

• Data grouping and Data environment buttons give you quick control over the
presentation of your data.

TECHNO INDIA GROUP Page No-185


BUSINESS SYSTEM Developed By Sangita Pal

Working with Controls on Report Canvas

You can create controls on your report or label with the Report Controls toolbar. Click the button for
the control you want, position the mouse pointer on the report, and click the report to place the
control or drag it to size. On a report, you can double-click any control to display a dialog box to set
options. Report controls toolbar is displayed automatically when you open Report Designer.

Report Controls toolbar is shown below:

Detailed View of Report Controls Toolbar

TECHNO INDIA GROUP Page No-186


BUSINESS SYSTEM Developed By Sangita Pal

Label Wizard
Label Wizard allows you to create labels from a Visual FoxPro database or a free table
using a selection of already provided standard label types. After you save a label created
by the wizard, you can open and modify it in the Label Designer.

To start a Label Wizard


Select TOOLS » WIZARDS » LABEL
OR
Select FILE » NEW » LABEL and then select Wizard.

Wizard Steps

Step 1: Select Tables


Step 1 of the Label Wizard allows you to select a table for the label.

Step 1 of Label Wizard

TECHNO INDIA GROUP Page No-187


BUSINESS SYSTEM Developed By Sangita Pal

Step 2: Choose Label Type

This step is the key to the Label Designer because you must select a label format. FoxPro
has licensed the Avery Label formats, which gives you a wide selection label sizes and
shapes. Your selection of a label will then be carried over into the Label Designer
window and will automatically set the band length, width, and print characteristics. This
includes automatic setting for the standard "one-up", "two-up", "three-up" and "four-up"
label sheets (labels printed in 1 to 4 columns).

Step 2 of Label Wizard

TECHNO INDIA GROUP Page No-188


BUSINESS SYSTEM Developed By Sangita Pal

Step 3: Define Layout

Add the fields in the order you want them to appear on the label. You can use the
punctuation, space, and new line buttons to format the label. Use Text box to add text. As
you add items to the label, the picture in the wizard window is updated to show
approximately how your label will look. Check this picture to see if the fields you have
chosen fit on the label or not. The text lines will extend beyond the bottom edge of the
label if there are too many lines. You can also use the Font button to change the font used
on labels.

In the end, you should have patched together something that looks like a normal label
(note the graphic presentation in the upper-left corner of the step 3 window. Then you
move on to step 4.

TECHNO INDIA GROUP Page No-189


BUSINESS SYSTEM Developed By Sangita Pal

Step 4: Sort Records


In this step you select the fields you want to use for the sort order of the labels.

TECHNO INDIA GROUP Page No-190


BUSINESS SYSTEM Developed By Sangita Pal

Step 5: Finish
This final step tells you that you have finished work in the wizard. If you have chosen to
create a Microsoft Word document, the wizard will open the document in Microsoft
Word. If you have chosen to create a text file, the wizard will prompt you to save.

Step 5 of Label
Extension of Label files is .lbx.

Label Designer
The Label Designer enables you to create and modify labels. When you activate Label
Designer window, Visual FoxPro automatically displays Report menu and Report
controls toolbar. Label Designer is almost identical to Report Designer but there are two
important differences. First, you can select the type of Label you want to use. Second,
only the Detail band has any output.
You can quickly create a label layout simply by clicking Quick Report on Report menu.
• To start a Label Designer.
• Select FILE » NEW » Label and then click on the New File button.

TECHNO INDIA GROUP Page No-191


BUSINESS SYSTEM Developed By Sangita Pal

Mail Merge Wizard

Another kind of data transfer, one that has traditionally held an important place in PC data
management, is called Mail Merge. Although the name is misleading (you can do far
more than send letters with the technique), mail-merge is the blending of data supplied by
a data management program with the documents provided by a word-processing program.
Word processors store data poorly (if at all), and database programs do not engage in
word-processing efficiently, hence the combination of the two is required. This can be
easily accomplished with the help of Mail Merge Wizard available in Visual FoxPro.

To use this wizard, you must have Microsoft Word for Windows (6.0 or higher) and
ODBC drivers for FoxPro installed on your computer (that should have been done when
you installed FoxPro) in order to create an MS-Word merged document.

Visual FoxPro setup can install FoxPro.

Before you start the wizard, you must have in your mind what will be your data source
and which will be the Word document to be used. Mail Merge documents can be of any
kind — Visual FoxPro supports four document types in the wizard: Form Letter, Label,
Envelope, and Catalog.

TECHNO INDIA GROUP Page No-192


BUSINESS SYSTEM Developed By Sangita Pal

How to Start Mail Merge Wizard

To start Mail Merge Wizard, select Tools » Wizards » MAIL MERGE

Wizard Steps

Step 1: Select Fields


This step allows you to select those fields (fields can be only from a single table or view)
that you want incorporated in the word-processing document.

TECHNO INDIA GROUP Page No-193


BUSINESS SYSTEM Developed By Sangita Pal

Step 2: Choose Word Processor

In this step, you must have current version of Microsoft Word installed on your computer
if you select Microsoft Word.

If you select comma-delimited text file, the wizard will skip step 3 and step 4 and go
straight to the FINISH screen.

TECHNO INDIA GROUP Page No-194


BUSINESS SYSTEM Developed By Sangita Pal

Step 3: Select Document Type

Step 3 allows you choose to create a new word-processing document or use an existing
document (which you must locate for the wizard).

TECHNO INDIA GROUP Page No-195


BUSINESS SYSTEM Developed By Sangita Pal

Step 4: Choose Document Style


Step 4 allows you to select the type of document — Form Letter, Label, Envelope, or
Catalog.

Step 4 of Mail Merge

TECHNO INDIA GROUP Page No-196


BUSINESS SYSTEM Developed By Sangita Pal

Step 5: Finish

This final step tells you that you have finished work in the wizard. If you have chosen to
create a Microsoft Word document, the wizard will open the document in Microsoft
Word. If you have chosen to create a text file, the wizard will prompt you to save.

If you have selected Microsoft Word document (and new document in Step 3) then as
soon as you click on FINISH push button you immediately enter MS-WORD (in Mail-
Merge environment). Once you are in Word for Windows, you will need to complete the
document by adding appropriate text. Then you use Word's mail merge operations
(TOOLS » Mail Merge in Word menu) to actually run the mail merge and print the
document.

TECHNO INDIA GROUP Page No-197


BUSINESS SYSTEM Developed By Sangita Pal

Cross-Tab Wizard

Cross-Tab Wizard creates a Cross-Tab Query to display results of a Query in a


spreadsheet format. Cross-Tab Query is similar to a Pivot table used in Excel.

To create a Cross-Tab Wizard:


Select Tools » Wizard » Query » Cross-Tab Wizard
The Cross-Tab Wizard appears immediately.

Steps of Cross-Tab Wizard


Step 1: Select Fields
♦ You can select fields only from a single table or view.

Step 1 of Cross-Tab Wizard

TECHNO INDIA GROUP Page No-198


BUSINESS SYSTEM Developed By Sangita Pal

Step 2: Define Layout

♦ Your Cross-Tab Query results will display a column for each unique value that exists
for the table field that you drag to the Data box.

Step 2 of Cross-Tab Wizard

Step 3: Add Summary Information


♦ You can add a column that contains summary information and subtotals by selecting
appropriate radio buttons from Summary and Subtotals areas. The totals will appear in
rightmost column of your Cross-Tab Query results.

TECHNO INDIA GROUP Page No-199


BUSINESS SYSTEM Developed By Sangita Pal

Step 3 of Cross-Tab Wizard


Step 4: Finish
♦ To display results in a Browse window, select Save and run cross-tab query.

Step 4 of Cross-Tab Wizard

TECHNO INDIA GROUP Page No-200


BUSINESS SYSTEM Developed By Sangita Pal

Structured Query Language (SQL)

SQL (Structured Query Language) is a database sublanguage for querying and modifying
relational databases. It was developed by IBM Research in the mid 70's and standardized
by ANSI in 1986.

SQL is a keyword based language. Each statement begins with a unique keyword. SQL
statements consist of clauses which begin with a keyword. SQL syntax is not case
sensitive.

SELECT statement
The SQL SELECT statement returns a result set of records from one or more tables.
It retrieves zero or more rows from one or more base tables, temporary tables, or views in
a database. In most applications, SELECT is the most commonly used Data Manipulation
Language (DML) command.

The SELECT statement has many optional clauses:


* WHERE specifies which rows to retrieve.
* GROUP BY groups rows sharing a property so that an aggregate function can be
applied to each group.
* HAVING selects among the groups defined by the GROUP BY clause.
* ORDER BY specifies an order in which to return the rows.

Syntax
SELECT column_name(s) FROM table_name
and
SELECT * FROM table_name

The asterisk (*) is a quick way of selecting all columns.

TECHNO INDIA GROUP Page No-201


BUSINESS SYSTEM Developed By Sangita Pal

DISTINCT Statement
In a table, some of the columns may contain duplicate values. This is not a problem;
however, sometimes you will want to list only the different (distinct) values in a table.
The DISTINCT keyword can be used to return only distinct (different) values.

Syntax
SELECT DISTINCT column_name(s) FROM table_name

WHERE Clause
The WHERE clause is used to extract only those records that fulfill a specified criterion.

Syntax
SELECT column_name(s) FROM table_name WHERE column_name operator value

The AND & OR Operators


The AND & OR operators are used to filter records based on more than one condition.
The AND operator displays a record if both the first condition and the second condition is
true.

The OR operator displays a record if either the first condition or the second condition is
true.

ORDER BY Keyword
The ORDER BY keyword is used to sort the result-set by a specified column. The
ORDER BY keyword sort the records in ascending order by default. If you want to sort
the records in a descending order, you can use the DESC keyword.

Syntax
SELECT column_name(s) FROM table_name ORDER BY column_name(s) ASC|DESC

TECHNO INDIA GROUP Page No-202


BUSINESS SYSTEM Developed By Sangita Pal

BETWEEN Operator
The BETWEEN operator selects a range of data between two values. The values can be
numbers, text, or dates.

Syntax
SELECT column_name(s) FROM table_name WHERE column_name
BETWEEN value1 AND value2

IN Operator
The IN operator allows you to specify multiple values in a WHERE clause.

Syntax
SELECT column_name(s) FROM table_name
WHERE column_name IN (value1,value2,...)

GROUP BY Statement
The GROUP BY statement is used in conjunction with the aggregate functions to group
the result-set by one or more columns.

Syntax
SELECT column_name, aggregate_function(column_name) FROM table_name
WHERE column_name operator value GROUP BY column_name

HAVING Clause
The HAVING clause was added to SQL because the WHERE keyword could not be used
with aggregate functions.

Syntax
SELECT column_name, aggregate_function(column_name) FROM table_name
WHERE column_name operator value GROUP BY column_name
HAVING aggregate_function(column_name) operator value

TECHNO INDIA GROUP Page No-203


BUSINESS SYSTEM Developed By Sangita Pal

Business Applications

Complete financial accounting course or tutorial covers a range of following topics. It is


being evaluated that how computers have affected traditional accounting methods and
practices.

• Financial Accounting with Double Entry Bookkeeping


• Principles of Accounting
• Basic Book of Accounting - Journal
• Accounting Ledger
• Accounting Sub Journals - Cash Cook
• Subsidiary Accounting Books
• Accounting Verification by Trial Balance
• Banking Transactions Bank Reconciliation Statement
• Depreciation
• Rectification Of Accounting Errors
• Balance Sheet and Profit and Loss Account
• Single Entry Bookkeeping Accounting System
• Non Profit Organization Accounting
• Capital and Revenue
• Reserves and Provisions

In a very short span of time, computer has grown from a scientific curiosity to an
indispensable tool of modem society. There is hardly any scientific/technical or business
activity which is not in one way or the other, affected by modern data processing
techniques.

The human mind can handle only a limited number of things at a time. The digital
computer, on the other hand, can be programmed to compare, measure, calculate and
evaluate thousands of readings in an extremely short period of time.

TECHNO INDIA GROUP Page No-204


BUSINESS SYSTEM Developed By Sangita Pal

The computer industry has become the fastest growing industry these days. The sale of
mainframe computers is increasing day by day. The computer industry has been further
pushed up by the introduction of mini computer and micro computers which are small,
cheap, reliable and very light. These are being routinely used for process control,
production testing, scientific instrument recording, in store check out systems, in
automobile test and evaluating systems, and medical monitoring etc.

Computers are now being used extensively in office administration to perform the routine
clerical work. Today, most large and medium sized organizations are almost totally
dependent on their computers. Routine uses of computers are given below:

(i) Accounting, Billing, Inventory Control Software with MIS, CRM


Computers are extensively used in accounting and there are multitudes of computer
software for Accounting, MIS, and CRM. Hi-Tech Financial Accounting is one such
software which has been customized for users in many segments in business and services.

(ii) Payroll and personnel records


Payroll accounting was the first commercial area to become widely computerized. The
calculation of wages or salaries involves a number of variables which relate to the
personal details of each employee, such as gross pay or rate for the job, individual
deductions, tax liabilities of the employees and so on. These facts can be retained in the
computers and processed every month of produce pay slips for the employees.

(iii) Stock control


The computer helps to exercise the type of stock control needed by the organization. It up
to dates the sales and purchases records, determines optimum re-order levels for different
items and prints out the stock lists when desired. The system can be so designed that it
triggers orders when stock level reaches order point for various material items; tests those
item which are slow moving or gives list for over stock items.

TECHNO INDIA GROUP Page No-205


BUSINESS SYSTEM Developed By Sangita Pal

(iv) Sale accounts records


Programming can be done for any sales accounting system. The computer will pin point
defaulting debtors, determine the right limit for credit for each debtor and maintain stores
ledger.

(v) Costing and budgetary control


Costing and budgetary control can be affected through the computer; the computer will
point out the variations from the planned performance.

(v) Production control


The computer also helps greatly in production planning and control. It is possible that
scheduling of the work may become necessary due to break downs etc. A new critical
path may have to be worked out. A critical path is the shortest path to be followed in
production to achieve production objectives. The computer helps the management lay
down this new critical path.

Advantages and disadvantages of a computer


A computer is surely advantageous because of the high speed of operation and greater
accuracy it provides, savings effected by better managerial control, savings in labor
because it is fully automatic and finally because of its flexibility in use. However, there is
a considerable capital outlay with difficulty of obtaining experienced analysts and
programmers, break down and maintenance troubles and finally fear of obsolescence due
to rapid development of computers.
Type of other applications in relation to accounting system

WORD PROCESSOR
It is a software package to help in text processing. Words are processed. Processing
includes insertion, deletion changing, moving words, paragraphs etc. Word processing is
the preparation of type scripts, using computing facilities for the storage and manipulation
of text. For example, word processor has ability to merge name and addresses with

TECHNO INDIA GROUP Page No-206


BUSINESS SYSTEM Developed By Sangita Pal

standard text so as to give impression that the latter is personalized even in case of
circular letter.

Hi-Tech Financial Accounting has got features so that you can export its reports to
Microsoft Word, a word processing and Mail Merge Program. You can also write letters
to various parties and store the details in the program database.

DATA BASE
It is simple collections of information (data) on a particular subject. Data base file allows
you to manipulate the data in desired form. So, data base allows us to work on facts and
figures to store and manipulate that data in any desired way. For example, from the same
basic information trial balance is prepared; trading and profit and loss account may be
prepared; list of debtors and creditors may be prepared; purchases and sales forecast may
be made and so on. So, an efficient data-base management is needed to provide flexibility
in uses of information.

Hi-Tech Financial Accounting uses MS Access and MS SQL server databases for robust
database connectivity.

SPREAD SHEET
It is one of the software programs which have increased the utility of computer for
accounting purposes. Spread sheet programs help you to draw vertical as well as
horizontal columns on a large sized paper. Each .column's length and breadth can be
adjusted according to suitability. Even when columns are once drawn subsequently these
can be altered, increased or decreased additional columns can be inserted, and existing
columns can be deleted. It is very useful for businessmen and professionals. It enables us
to study multidimensional data at one sheet and helps in arriving at logical decisions. For
example, if profit and loss account has been prepared for the year 1989 and you want a
comparison with 1987 figures and 1990 forecast then spread sheet shall enable you to
provide two additional columns on each side for inserting 1987 actual figures and 1990
forecast estimates.

TECHNO INDIA GROUP Page No-207


BUSINESS SYSTEM Developed By Sangita Pal

Computerized Inventory Control System


Inventory control systems maintain information about activities within firms that ensure
the delivery of products to customers. The subsystems that perform these functions
include sales, manufacturing, warehousing, ordering, and receiving. In different firms the
activities associated with each of these areas may not be strictly contained within separate
subsystems, but these functions must be performed in sequence in order to have a well-
run inventory control system.

In today's business environment, even small and mid-sized businesses have come to rely
on computerized inventory management systems. Certainly, there are plenty of small
retail outlets, manufacturers, and other businesses that continue to rely on manual means
of inventory tracking. Indeed, for some small businesses, like convenience stores, shoe
stores, or nurseries, purchase of an electronic inventory tracking system might constitute a
wasteful use of financial resources. But for other firms operating in industries that feature
high volume turnover of raw materials and/or finished products, computerized tracking
systems have emerged as a key component of business strategies aimed at increasing
productivity and maintaining competitiveness. Moreover, the recent development of
powerful computer programs capable of addressing a wide variety of record keeping
needs—including inventory management—in one integrated system have also contributed
to the growing popularity of electronic inventory control options.

Automation can dramatically impact all phases of inventory management, including


counting and monitoring of inventory items; recording and retrieval of item storage
location; recording changes to inventory; and anticipating inventory needs, including
inventory handling requirements. This is true even of stand-alone systems that are not
integrated with other areas of the business, but many analysts indicate that productivity—
and hence profitability—gains that are garnered through use of automated systems can be
increased even more when a business integrates its inventory control systems with other
systems such as accounting and sales to better control inventory levels.

TECHNO INDIA GROUP Page No-208


BUSINESS SYSTEM Developed By Sangita Pal

Computerized Payroll System

Processing payroll can be one of the most complex tasks facing an organization. Besides
simply paying your employees, you will need to file taxes, submit reports and process
year-end data for tax-reporting purposes. To determine the best payroll system for your
company, consider the following points:

There are two basic types of payroll systems.


o Manual payroll means that you, or another employee within your company,
calculate the payroll each pay period entirely on paper. You will need to calculate taxes,
insurance, 401K, and any other applicable deductions in addition to each employee's
actual earnings. The advantage of using a manual system is that it is very inexpensive,
with virtually no start-up costs. The disadvantage is that whatever you save on start-up
costs will probably be eaten up by the amount of time it takes to process payroll. In
addition, it's very easy to make mistakes when processing payroll manually, and the
penalty for mistakes, especially mistakes in taxing, can be very costly. There are at least
free payroll templates out there, but it still difficult to do manual payroll processing.

o The second type of payroll system is computerized. Many companies offer


computer software that will assist you in processing payroll. You will need to input
information for each employee when he is hired, but after that, the software will calculate
payroll taxes and other deductions automatically. Most programs will also process W-2
forms for each employee at year-end, which can be a real time-saver. The advantages of
this type of payroll system are numerous - fewer potential mistakes and less time spent
processing payroll. In addition, employees can be trained to run the program more easily,
so you won't need to depend on just one person to process payroll. The disadvantages are
that you still have to input each employee's hours manually, and the software has to be
updated annually or whenever new tax laws go into effect. There can also be additional
charges if the software has to be configured specifically for your business.

TECHNO INDIA GROUP Page No-209

Vous aimerez peut-être aussi