Showing posts with label FoxPro. Show all posts
Showing posts with label FoxPro. Show all posts

FoxPro : LIST and DISPLAY

For show what is stored in database file there are two commands used in FoxPro- 
1. LIST   2. DISPLAY

LIST:  LIST provides facility to show all the records available in database file continuously. We also use LIST command to show the specific record only according to given condition and with specified field only
        Syntax:         LIST  [field1,field2…fieldn] FOR (expressions)
Ex:
                LIST                                                        (Show all the records continuously)
                LIST  FOR  NAME=”Tony”                   (Show only record related to name Toney)
                LIST  FOR ROLL>80                           (Show records which ROLL is greater than 80)
                LIST  FIELDS NAME, ROLL FOR PIN=803213            
(show record with field NAME and ROLL          
which PIN =803213)
Note:     1. expression may be mathematical and logical
                2. In expression character data is enclosed inside (“  “or ‘ ‘ or [ ])


DISPLAY: DISPLAY command is other variant of LIST command that is worked something same as LIST command. Simple DISPLAY command show the current record only where pointer is pointed. Pointer is controlled with GOTO command.
Actually DISPLAY ALL is equal to LIST but major difference between LIST and DISPLAY ALL is LIST show all record continuously where DISPLAY Pause when screen is fill with record and prompt and ask “press any key to continue..”

        Syntax:           DISPLAY  [field1,field2…fieldn] FOR (expressions)
EX:         
                USE  ADDRESS                                                   (Before using DISPLAY command it is necessary)
                DISPLAY ALL                                                       (Display all record and prompt for “press any  key  to continue”)
                DISPLAY  FOR name=”Tony”                        (Display all record that have name Tony)
                DISPLAY  ALL  FIELDS NAME, CITY, MOB  FOR PIN=803213 (show record with field NAME, CITY,
                                                                                                                                    MOB which has PIN=803213)
                GOTO 5                                                                                (GOTO command is used to set the pointer to record 5)               
DISPLAY                                                               (Display record 5 only)
DISPLAY NEXT 3                                                                (Display Record 5, 7 and 8)

Note:    
·      OFF clause can be included with DISPLAY and LIST command that hide the external Record # field on screen
·      We can print the record directly with just adding TO PRINTER clause with LIST or DISPLAY
Command.
Ex:
          DISPLAY ALL TO PRINTER              (It print the whole record and display it on screen)
          LIST TO PRINTER                               (It print the whole record and display it on screen)


USE command is used to specify on which Database file we are going to perform task.
GOTO command is used to set the pointer of record at specified record number.
        Syntax:           GOTO TOP or BOTTOM or [record no]

SET HEADING ON/OFF is used to hide or show the field name from list on screen.
SET STATUS ON/OFF command is used to turn on or off the status bar. Status bar situated at
bottom side off window. It show the name of open file and pointer of record.
SET DEFAULT provide facility to set the default directory to store files
                Ex:
                                SET DEFAULT TO D:                        (Set the Defalut Directory D:)
                                SET DEFAULT TO D:\FOX               (Set the Defalut Directory Fox under disk drive D:)

CLOSEing the database and FoxPro Windows QUIT

CLOSE DATABASE is used when we want to close the open database files.
CLOSE ALL is used to close all the open Database files as well as indexes and other open file.

·         To exit  form Fox pro window do on of the following-
a.       File menu-Exit option.
b.      Type QUIT in Command window.
QUIT command is used to close open window of FoxPro.


Read More

Creating a Database File


Before Creating Database in fox pro we should understand Data type. Various type of data type used according to requirement-
Data type
Size (bytes)
Description
Range
Character
1 to 254
Any Characters and text  abb- C
ex- a-z, ?, # etc
Numeric
1 to 20
Integer and fraction , abb.-N
- .9999999999E+19 to .9999999999E+20
Currency
8 bytes
Amounts, abb.- Y
- 922337203685477.5807 to 922337203685477.5807
Date
8 bytes
Date entry, Abb.- D

Datetime
8 bytes
Date with time, Abb.- T
Time in 00:00:00 to 11:59:59
Logical
1 bytes
Logical entry, Abb.-L
Only .T. and .F.
Double
8 bytes
More accurate with fraction, abb.-B
- .9999999999E+19 to .9999999999E+20
Integer
4 bytes
Space saver data type for numeric, abb.- I
-2,147,483,647 to 2,147,483,647
Float
1-20
Same as numeric, abb-F
- .9999999999E+19 to .9999999999E+20
Memo
4 bytes
Used to store more information in foxpro it is not saved in dbf file. It is saved seperatly in FPT file, abb.-My name
Any text, symbol
General
4 bytes
Closely same as memo and its content is housed iin FPT file, abb- G
Any OLE document



Principal file types related to database-
1. DBF-( Database file) it is primary extension of foxpro. It is main storage file of database.
2. DBC- (Database container) Contains information aobut data file indexes, relationaships and other aspects of a database. It is sometime called database dictionary.
3. DCT- (Database Container Text) stores the code and other text material for DBC file this is not directly readable by FoxPro.
4. FPT- (FoxPro Text) it can store large quantities of text, picture.  Here general data of general field and memo fields are stored.
5. CDX-(CompounD indeX) Contain the indexes or DBF file.
6. BAK- (BAcK up file) it is created for DBF file.
7. PRG- (PRoGram file) it contain the source code of program
8. SCX-(Screen File) it store the form.
9. FRX-(Report file) it store the report.
Creating Database
Ø  There are two method to create database in foxpro-
        1. Type CREATE in command window. in open box type file name -- ok
        2. File menu—New-
                -A box will open here select Table/DBF radio button
                -ok
·         In both case a box will open –
·         Here define the structure according to requirement- Such as field name data type it’s range
Field Name
Data type
Width
Name
Character
20
Location
Character
15
Address
Character
15
PIN
Character
8
Mob
Character
10
·         Ok
·         A box will appear that say input record or not choose yes
·         A window will appear hear each field name will show in separate row
·         Fill the record one by one
·         When finish press Esc  button
Name
Location
Address
PIN
Mob
Tony
Station road
Barh
803213
98765778
Pyush
Bedhna
Barh
803213
99766666
Swati
Station road
Barh
876655
99877666
Kundan
GulabBagh
Mokama
876555
08877666
Nitish
Fathuha
Patna
876555
98766666
 Note :
1.       don’t use Numeric type data when not necessary, such as  In PIN we can use Number data type but it require more space in memory hence character is used.
2.       When we use file menu – new then file will created with untitled.dbf extension

Command:

1. CREATE: it provide facility to define structure of Database file.

        Syntax:           CREATE  <Path with file name>

Ex:                                         
CREATE  address.dbf                  (create database file address in current directory)
CREATE  d:\address.dbf              (create database file in d: drive)
CREATE  d:\my\address.dbf        (create database file in directory of drive d:)
   

Read More

FoxPro 2.6 : Introduction


  • Fox pro is one of the best Data base Management Software (DBMS) application for PC.
  • First DBMS for the PC was developed by ASSTON-TATE in 1979-80 that was called dBASE II. Then the company introduced the updated version of dBASE II in 1984 that was called dBASE III.  Later company  was developed enhanced version of dBASE III called dBASE III plus.
  • Arround 1990, Fox Software, Inc. developed a new Programming language FoxBASE become the another very popular DBMS software and share DBMS market with dBASE. FoxBASE was next reanamed as  FoxPro and updated for most powerful it was compatible with dBASE III and very userfriendly.
  • FoxPro is not only DBMS but more than it and popularly called RDBMS package.
  • Initially it was developed for DOS based environment. But after version 2.6 it is also available for windows and other enviornmet.
  • Around 1992, Fox Software, Inc. was merged with Microsoft  Corporation and released FoxPro 2.6. Soon Microsoft update it and renamed as Visual FoxPro (VFP). Microsoft next released many version some of them are- VFP 5.0, VFP 7.0, VFP 9.0. In 2007 Microsoft announced no anymore version of VFP will released next and development was closed. Latest version of VFP is Visual FoxPro 9.0.
  • Using FoxPro we can easily handle Database of small organization or company.
System Requiremet for Fox Pro 2.5 and 2.6
  •      Processor- 80386 or above
  •      Memory- 3-4 MB
  •      Disk Space- 20 MB
  •      Operating System –Windows, Dos
  •      CD or FD Drive


Steps to Start FoxPro
Version to Version Steps of launching FoxPro may be changed but overall steps are following-
1.       Find the location of directory where fox pro was installed-
A. DOS-
Ø  Use CD command to find ex- type CD  C:\FOXPROW
Ø  Type FoxPro and Enter
B. Windows-
Ø  find the location using my computer
Ø  double click on FOXPROW.exe

Note: Both Fox Pro for Windows or DOS functions are same but interface is different. When we clearly understand functionality of one version other can be easily handled. So primary goal for us is  learn fox pro not version has major concern.
FoxPro 2.6 For Windows

FoxPro 2.5 For DOS
When FoxPro window will open then it looks like above
Menu Bar (Pad) :  In any program many options and commands are available. All these commands are grouped and menu and the place where all these are stay called menu bar. In DOS based environment it is called Menu Pad. We use menu using mouse or keyboard-
a.       To select menu form keyboard press ALT or F10 button. then a character of menu will highlighted when we press this key form keyboard that menu fly out will open. Such as when want to open File menu we press ALT then F.
b.      To select menu from mouse move your mouse all menu that want to open and then click.
Command Window: In Fox pro Command Window is default available at right side. We use it to entering the command and directly perform task instead of using mouse and menu. It is faster way to perform operation. Mostly options can be handled using command window but some are not performed through where some are not performed  using mouse.
Some time Command Window not appear then use any of the following-

                          1.       Window menu- command
                          2.       Ctrl+F2
Status Bar: Status Bar available at bottom of FoxPro window . it show the status such as – EOF(End of File), Open database. It also display help about what task performed by this command when cursor is placed on any option.
     
Read More