Docsity

FoxPro Programming, Lecture notes of Decision Making

Toggle sidebar
bg1
Shiavm Computer Training Center 1
Prepared By: Rushabh P Madhu & P. C. Solanki
FoxPro Programming
What is Data? Data can be anything like a name of person rollno of student or name of
a city.
What is Information? When Data is in meaning full way or related with each other its called
Information.
What is Database? Database is an organized collection of related information.
What is DBMS? DBMS stands for Database Management System. The system which
collect data from user and manage that data properly, is called
Database Management system.
What is RDBMS? RDBMS stands for Relational Database Management System. RDBMS
is advance feature of DBMS. RDBMS provide the facility to create a
relation between two tables.
What is FILE ?:- In FoxPro File is a collection of records and fields. Row represent
record and column represent field.
What is RECORD ?:- Data is stored in one horizontal line of database is called record. In
other words Record is a collection values in fields of table.
What is FIELD ?:- Field is a basic part of any database column is also called field but in a
perfect way Field is a collection of data of same type and nature.
What is Col. Width? The number of digit you specify with each fieldname is called column
width.
What is FoxPro? FoxPro is one of the leading DBMS(Database Management System)
software for pc. This is enhanced version of the FoxBASE+ Software
FoxPro is also called RDBMS software.
DBMS software:- 1.Dbase 2.Foxpro 3.Foxbase
RDBMS software:- 1.Oracle 2.Foxpro 3.MySQL server 4.MS Access
Extension of FoxPro:- 1) ‘.txt.’ 2) ‘.dbf’ 3) ‘.prg’ 4) ‘.scr’ 5) ‘.frx’
Rules to create a new file:-
1. Filename must start with an alphabets
2. Filename has maximum of eight characters.
3. Filename has only alphabets (A to Z, a to z, “_” underscore , 0 to 9 digit)
4. In Filename there must be no white space.
5. Filename must be unique. we can not type the same name as we type earlier.
Rules to create a New Field:-
1. Fieldname must start with an alphabets
2. Fieldname has maximum of ten character long
3. Fieldname has only alphabets (A tO Z, a to z, “_”underscore , 0 to 9 digit)
4. In Fieldname there must be no white space.
5. Fieldname must be unique.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24

Partial preview of the text

Download FoxPro Programming and more Lecture notes Decision Making in PDF only on Docsity!

FoxPro Programming

What is Data? Data can be anything like a name of person rollno of student or name of

a city.

What is Information? When Data is in meaning full way or related with each other its called

Information.

What is Database? Database is an organized collection of related information.

What is DBMS? DBMS stands for Database Management System. The system which

collect data from user and manage that data properly, is called Database Management system.

What is RDBMS? RDBMS stands for Relational Database Management System. RDBMS

is advance feature of DBMS. RDBMS provide the facility to create a relation between two tables.

What is FILE ?:- In FoxPro File is a collection of records and fields. Row represent

record and column represent field.

What is RECORD ?:- Data is stored in one horizontal line of database is called record. In

other words Record is a collection values in fields of table.

What is FIELD ?:- Field is a basic part of any database column is also called field but in a

perfect way Field is a collection of data of same type and nature.

What is Col. Width? The number of digit you specify with each fieldname is called column

width.

What is FoxPro? FoxPro is one of the leading DBMS(Database Management System)

software for pc. This is enhanced version of the FoxBASE+ Software FoxPro is also called RDBMS software.

DBMS software:- 1.Dbase 2.Foxpro 3.Foxbase

RDBMS software:- 1.Oracle 2.Foxpro 3.MySQL server 4.MS Access

Extension of FoxPro:- 1) ‘.txt.’ 2) ‘.dbf’ 3) ‘.prg’ 4) ‘.scr’ 5) ‘.frx’

™ Rules to create a new file:-

  1. Filename must start with an alphabets
  2. Filename has maximum of eight characters.
  3. Filename has only alphabets (A to Z, a to z, “_” underscore , 0 to 9 digit)
  4. In Filename there must be no white space.
  5. Filename must be unique. we can not type the same name as we type earlier.

™ Rules to create a New Field:-

  1. Fieldname must start with an alphabets
  2. Fieldname has maximum of ten character long
  3. Fieldname has only alphabets (A tO Z, a to z, “_”underscore , 0 to 9 digit)
  4. In Fieldname there must be no white space.
  5. Fieldname must be unique.

Difference between DBMS and RDBMS:-

DBMS RDBMS

  1. DBMS stands for Database Management System. 1. RDBMS stands for Relational Database Management System.
  2. In DBMS we cannot create relation between two tables. 2. RDBMS provide facility to create relation between two tables.
  3. DBMS may satisfy less than 7 to 8 rules of Dr.E.F.Codd. 3. DBMS may satisfy more than 7 to 8 rules of Dr.E.F.Codd.
  4. In DBMS there is no security of data. 4. In RDBMS there are multilevel of security. (1) Logging in at o/s Level (2) Command Level (3) Object Level
  5. Each table is given extension of DBMS 5. Many tables are grouped in one database in RDBMS.
  6. DBMS use a 3GL. 6. DBMS use a 4GL.
  7. Ex. of DBMS are Dbase, FoxBASE, Foxpro 7. Ex. of RDBMS is Oracle, Access, SQL server.

Data types available in FoxPro

1. Numeric :-

Numeric datatype is use to store numeric data into a field. We can store 0 to 9 digit, decimal point and plus or minus sign. A numeric field can hold upto 20 digit wide. A numeric fields can also have a decimal part. The decimal part can be upto 0 to 18 digit. To store a field like Roll_no, mobile_no, phone_no, salary, pincode etc numeric field type is used.

2. Float :- Float datatype is similar to numeric. Difference between two is that for arithmetic calculation numeric datatype is used while float is used for scientific calculation. It can also hold upto 20 digit wide. We can store 0 to 9 digit, decimal point and plus or minus sign. To store the fields like Rate, percentage, average float is commonly used. 3. Character :- Character datatype is use to store string type information. It can store A to Z , a to z alphabets 0 to 9 digit and underscore with special symbols etc. To store the fields like name, address, result etc character is used. Character is default datatype for all the fields. In Character data type we can store upto 254 character. Default size of character is 10 fix. 4. Date :- Date datatype is use to store date in any field. The default format of date is (mm/dd/yy). The fix length of date is 8.To store the fields like Dob, doj, ex_date etc date field is used. 5. Logical :- The length of logical field is 1. we can store ‘T’ or ‘F’ or ‘Y’ or ‘N’ in logical field. ’T’ or ‘Y’ for true and ‘F’ and ‘N’ for False. To store the information like pass/fail, absent/present etc. logical field type is used. 6. Memo :- Memo field is special field of FoxPro in which you can store any amount of data. Memo field is use to store long textual information. The name of memo file has ‘.fpt’ extension. FoxPro allocates a ten bytes space in main dbf to store the location of memo data is in auxiliary memory. 7. General :- General field is use only for FoxPro for window version. In general field we can store textual data, picture, sound etc.

Note :- In FoxPro picture field type is not used.

[WHILE ] clause:- If the WHILE clause is included, records are displayed for as long as the logical expression evaluates to true. [OFF] clause:- Include OFF to suppress record number display. If OFF is omitted, the record number is displayed before each record.

10. List command :-

List command displays all the records of currently open table and the result of expression. Syntax:- List [[FIELDS] ] [] [FOR ] [WHILE ] [OFF] [[FIELDS] ] Clause:- All fields from the table/.DBF are displayed unless you include FIELDS . Then, only the fields included in the field list are displayed. [] clause:- The scope clauses are: [1] ALL [2] NEXT [3]RECORD [4] REST You can specify any scope of records to display. Only the record that fall with in the range of records specified by the scope are displayed. The default scope for LIST is the ALL record.

FOR] clause:- Including the FOR clause lets you conditionally display records, filtering out undesired records. If the FOR clause is included, only the records that satisfy the logical condition are displayed.

[WHILE ] clause:- If the WHILE clause is included, records are displayed for as long as the logical expression evaluates to true.

[OFF] clause:- Include OFF to suppress record number display. If OFF is omitted, the record number is displayed before each record.

11. Edit /Change command:-

Edit or Change command is use to edit the record which are inserted before by us. Syntax:- Edit [[FIELDS] ] [FOR ] [WHILE ] [FREEZE] [NO APPEND][NO DELETE] [NO CHANGE | NO MODIFY] [[FIELDS] ] Clause:- If FIELDS is included in CHANGE/EDIT the listed fields are displayed in the order they appear in . If FIELDS isn't included, all fields in the table/.DBF are displayed in the order they appear in the table/.DBF structure..

[FOR] clause :- Including the FOR clause lets you conditionally display records, filtering out undesired records. If the FOR clause is included, only the records that satisfy the logical condition are displayed in the Change window. [WHILE ] clause :- If the WHILE clause is included, records are displayed in the Change window. For as long as the logical expression evaluates to true. [FREEZE ] Clause :- Include the FREEZE clause to allow changes to be made to a single field in the Change window. You specify this field with . The remaining fields are displayed and cannot be edited.

[NOAPPEND] Clause :- If you include NOAPPEND in CHANGE, you can't add records to the table/.DBF by pressing Ctrl+N or choosing Append Record from the Browse menu.

[NODELETE ] Clause :- Including NODELETE prevents records from being marked for deletion from within a Change window. By default, a record can be marked for deletion by pressing Ctrl+T, choosing Toggle Delete from the Browse menu or clicking in the leftmost column of the record to be deleted.

[NOEDIT or NOMODIFY] Clause :- Including NOEDIT or NOMODIFY prevents you from modifying the table/.DBF. NOEDIT and NOMODIFY are identical. If you include either clause, you can browse or search the table/.DBF, but you cannot be edit it. However, you can append and delete records. Include NOAPPEND and NODELETE to prohibit the addition and deletion of records.

12.Browse command:-

Browse command opens a browse window to change records of currently open data base file like a tabular format. Syntax:- Browse [FIELDS] ] [FOR ] [WHILE ] [FREEZE] [WIDTH ] [FONT [,]] [STYLE] [NO APPEND][NO DELETE] [NO CHANGE | NO MODIFY]

[[FIELDS] ] Clause:- If FIELDS is included, the listed fields are displayed in the order specified in . If FIELDS isn't included, all fields in the table/.DBF are displayed in the order they appear in the table/.DBF structure.

[FOR] clause :- Including the FOR clause lets you conditionally display records in a Browse window, filtering out undesired records. If you include the FOR clause, only records for which the logical expression is true are displayed in the Browse window.

[WHILE ] clause :- If the WHILE clause is included, records are displayed in the Change window.For as long as the logical expression evaluates to true.

[FREEZE ] Clause :- Include the FREEZE clause to permit changes to be made to only one field in the Browse window. You specify this field with . The remaining fields are displayed and cannot be edited.

[FONT [,]]Clause:- The character expression is the name of the font, and the numeric expression is the font size. For example, the following clause specifies 16-point Roman font for the fields displayed in a Browse window: Example:- FONT 'ARIAL’,

If you include the FONT clause but omit the font size , a 10 point font is used in the Browse window. If you omit the FONT clause, 8 point MS Sans Serif is used. if the font you specify is not available, Windows substitutes a font with similar font characteristics.

15. Pack command:-

PACK command is use to permanently removes all records marked for deletion in the current table/.DBF. Synaex:- pack

16. Zap command:-

ZAP command is use to permanently removes all records from current table/.DBF. by leaving just structure of a table. Example:- zap

17. Skip command :-

Skip command is use to Moves the record pointer forward or backward in the current or specified table/.DBF. Syntax:- Skip [in or ] Example:- skip 2

18. Go/Goto command:-

Go/Goto command is use to Positions the record pointer on the specified record number in a table/.DBF. Syntax:- Go [in or ] GO TOP | BOTTOM Example:- Go top

19. Replace command :-

Replace command is use to insert a value in field. Replace is also use to change the value of fields in table/.DBF. Syntex:- REPLACE WITH [ADDITIVE] [, WITH [ADDITIVE]] ... [] [FOR ] [WHILE ] RPLACE WITH [, WITH ]: Data in a field1 is replaced with the value of exp1,the data in field2 is replaced with exp2. ADDITIVE clause:- The ADDITIVE clause applies to replacements in memo fields only. If ADDITIVE is included, replacements to memo fields are appended to the end of the memo fields. If ADDITIVE is not included, the memo field is overwritten with the value of the expression. [] clause:- The scope clauses are: [1] ALL [2] NEXT [3]RECORD [4] REST You can specify a scope of records to replace. Only the records that fall within the range of records specified by the scope are replaced. The default scope for REPLACE is the current record NEXT 1. [FOR] clause :- if the FOR clause is included, the specified fields are replaced only in records for which evaluates to true. Including FOR lets you conditionally replace records, filtering out undesired records. [WHILE ] clause :- If the WHILE clause is included, fields in records are replaced for as long as the logical expression evaluates to true.

20. Locate command :-

Locate command is use to search the record sequentially in table/.DBF. for the first record that matches a given logical exp. Syntex:- LOCATE FOR [] [WHILE ]

Locate command return the record number where it find the record with the true condition. Default scope of locate command is all records. Here for clause, scope clause and while clause works same as in other command. Plz to read from other command.

21. Sort command :-

Sort command is useful to sort records of the current database file and stored in a new database file Each sort command generate a new database file. Syntex:- SORT TO ON [/A | /D] [/C] [, [/A | /D] [/C] ...] [ASCENDING | DESCENDING] [] [FOR] [WHILE ] [FIELDS ] Clause:- When a table is sorted, a new table is created. specifies the name of the new table file. FoxPro assumes a .DBF file name extension for tables. A ‘.DBF’ extension is automatically assigned if the file name you include doesn't have an extension. ON Clause:- You must include a name of a field () from the current table. The contents and data type of the field determine the order of the records in new table. By default, the sort is done in ascending order. You can't sort on memo or general fields. You can include additional field names (, ) to further order the new table. The first field is the primary sort field, the second field is the secondary sort field, and so on.

[/A | /D] [/C] Clause:- For each field you include in the sort you can specify an ascending or descending sort order. The /A option specifies an ascending order for the field, and the /D option specifies a descending order. /A or /D can be included with any type of field. By default, the field sort order for character fields is case sensitive If you include the /C option after the name of a character field, case is ignored. You can combine the /C option with the /A or /D option. Use one slash (/AC or /DC) if you include the /C option with /A or /D.

ASCENDING | DESCENDING Clause:- You can specify a sort order for all sort fields not followed by the /A or /D options. All sort fields are sorted in ascending order if you include ASCENDING. All sort fields are sorted in descending order if DESCENDING is included. The sort fields default to an ascending order if ASCENDING or DESCENDING isn't included. [] clause:- The scope clauses are: [1] ALL [2] NEXT [3]RECORD [4] REST You can specify a scope of records to sort. Only the records that fall within the range of records specified by the scope are sorted. The default scope for SORT is ALL records. [FOR] clause :- If the FOR clause is included, only the records for which evaluates to true (.T.) are Sorted. Including a FOR clause lets you conditionally Sorting the records, filtering out undesired records.

[WHILE ] clause :- If the WHILE clause is included, records are sorted for as long as evaluates to true. FIELDS clause:- The new table that SORT creates can contain a subset of fields from the original table. All fields from the original table are included in the new table if the FIELDS clause isn't included. Include FIELDS and a to include specific fields from the original table.

26. Seek command :-

Seek command is use to search the record in index file. Seek search only in indexed file with an expression. Syntax : seek Example : seek “rus” You can use SEEK only with indexed tables/.DBFs, and you can search only on the index key expression. The match must be exact unless SET EXACT is OFF. If SEEK finds a matching record, RECNO( ) returns the record number of the matching record, FOUND( ) returns true and EOF( ) returns false. If no match is found, RECNO( ) returns the total number of records in the table/.DBF plus 1, FOUND( ) returns false and EOF( ) returns true.

27. Close all command :-

Close all command is use to close all open programs, databasefile, indexfile etc. Syntax:- Close all Example:- Close all

28. Scatter command :-

Scatter command is use to Copy data from the current record to an array or a set of memory variables. Syntax:- Scatter [Fields] to While scatter command is use it is necessary that array variable have the same size as many fields in the database file.If the array variable is not created before scatter command automatically create an array variable as the size as many records in the table/Database file. Example:- use student Go 1 Scatter to rec Scatter name,city,dob to rec

29. Gather command :-

Gather command is use Store data from a memory variable array or a set of memory variables to the current record of the active table/.DBF.While Gather command is used its necessary database file is open. Syntax:- Gather from [FIELDS]

If data is being copied from an array, the elements of the array are copied, starting with the first element,into the corresponding fields of the record. The contents of the first array element is copied to the first field of the record; the contents of the second array element is copied to the second field and so on.If the array has fewer elements than the table/.DBF has fields, the additional fields are ignored. If the array has more elements than the table/.DBF has fields, the additional array elements are ignored. Example:- use student Go bottom Gather from test Gather from test1 fields name,city,dob

Functions of FoxPro

1. Numeric Function 2. String Function

3. Date & Time Function 4. Array Function

1. Numeric Function:-

(1) Abs():- This function returns the absolute value of the specified numeric expression. Syntax : Abs() Function Returns : Numeric Example : Abs(-25) Output : 25

(2) Int():- This function returns the Ineger value from the specified numeric expression. Syntax :- Int() Function Returns :- Numeric Example :- Int(25.25) Output :- 25

(3) Floor():- This function returns the nearest integer value that is less than or equal to the specified numeric expression. Syntax : Floor() Function Returns : Numeric Example : Floor(51.85) Output : 51

(4) Ceil():- This function returns the nearest integer value that is greater than or equal to the specified expression. Syntax:- Ceil() Function Returns:- Numeric Example:- Ceil(27.35) Output:- 28

(5) Mod():- This function returns the remainder value by moduling expression1 to expression2. Syntax :- Mod(,) Function Returns :- Numeric Example :- Mod(5,2) Output :- 1

(6) Round():- This function Return a numeric expression rounded to a specified number of decimal places. Syntax:- Round(,) Function Returns:- Numeric Example:- Round(25.49) Round(25.51) Output:- 25 26

(7) Min():- This function Returns the expression with the lowest ASCII or numeric value or the earliest date in a list of character, numeric or date expressions. Syntax:- Min(,[……]) Function Returns:- Numeric,date,Character Example:- Min(10,20,5,85,50) Output:- 5

(8) Max():- Returns the expression with the highest ASCII or numeric value or the latest date from a list of character, numeric or date expressions. Syntax:- Max(,[……]) Function Returns:- Numeric,date,Character Example:- Min(10,20,5,85,50) Output:- 85

until exceeds the number of rows in the array, then the error message "Subscript out of bounds" is displayed. Example:- declare m1[5] declare m2[2,5] ?Aelement(m1,3) ?Aelement(m1,2,2) Output:- 3 7

(4) Ains():- This function is use to Inserts an element into a one-dimensional array, or a row or column into a two-dimensional array. AINS( ) returns 1 if the element, row or column is successfully inserted. Syntax:- AINS(, [, 2]) Function Returns:- Numeric To insert an element into a one-dimensional array, include the array name and the number of the element where the insertion occurs. The new element is inserted just before element . To insert a row into a two-dimensional array, include the array name and the number of the row where the insertion occurs. The new row is inserted just before row . To insert a column into a two-dimensional array, include the array name, the column number where the insertion occurs and the argument 2.The new column is inserted just before the column specified with. Example:- declare m1[5]={‘a’,’c’,’b’,’g’,’h’} ?Ains(m1,3) Disp memo like m Output:- m1[1]=’a’ m1[2]=’c’ m1[3]=’.f. m1[4]=’b’ m1[5]=’g’

Thus when we insert a new element in an array computer automatically drop the lat element and creat a blank space at specified no and default value is as .f. is assigned.

(5) Adel():- This function is use to Deletes an element from a one-dimensional array or a row or column from a two-dimensional array. If the element, row or column is successfully deleted, 1 is returned. Syntax:- ADEL (, [, 2]) Function Returns:- Numeric Deleting an element, row or column from an array doesn't change the size of the array; instead, the trailing elements, rows or columns are moved to the start of the array, and the last element, row or column in the array is set to a logical false (.F.). Example:- declare m1[5]={‘a’,’c’,’b’,’g’,’h’} ?Adel(m1,3) Disp memo like m Output:- m1[1]=’a’ m1[2]=’c’ m1[3]=’g’ m1[4]=’h’ m1[5]=’.f.’

(5) Asubscript():- This function Returns the row or column subscript of an element from the element's number. array. Syntax:- ASUBSCRIPT(, , ) Function Returns:- Numeric If the array is one-dimensional, include the element number in and 1 in . ASUBSCRIPT( ) identically returns .If the array is two-dimensional you must include both the element number and a value of 1 or 2 in . Specifying 1 in returns the row subscript of the element, and specifying 2 returns the column subscript. Example:- declare m1[5]={‘a’,’c’,’b’,’g’,’h’} ?Asubscript(m1,3,1) ?Asubscript(m1,5,1) Output:- 3 5 Example:- declare m1[3,2]={‘a’,’c’,’b’,’g’,’h’,’j’} ?Asubscript(m1,3,1) ?Asubscript(m1,5,) Output:- 2 3

(5) Acopy(): This function is use to Copies elements from one array to another array.This function returns the number of elements copied to the destination array. Syntax:- ACOPY(, [, [, [,]]]) Function Returns:- Numeric

3.Date and Time Function:-

(1) Date():- Date function returns the current date in mm/dd/yy format. This function is use to print date on report. Foxpro display the date as set above in computer. Syntax : Date() Example :? Date() Output : 01/21/ Function returns : Date

(2) Year():- Year function returns the numeric year from the date expression.This function is always display the year with century. Foxpro display the as set above in computer. Syntax:- Year() Example:-? Year(date()) Output:- 2008 Function returns: Numeric

(3)Month():- Month function returns the numeric month from the date expression. Foxpro display the month as set above in computer. Syntax:- Month() Example:-? Month(date()) Output:- 1 Function returns: Numeric

(4)Cmonth():- Cmonth function returns the name of month in character from the date expression. Foxpro display the monthname as set above in computer. Syntax:- Cmonth() Example:-? Cmonth(date()) Function returns: Character Output:- January

(5)Day():- Day function returns the numeric day value from the date expression. Foxpro display the day as set above in computer. Syntax:- Day() Example:-? Day(date()) Output:- 21 Function returns: Numeric

(6)CDOW():- CDOW means character day of week.This function returns the character day from the date expression. Foxpro display the day as set above in computer. Syntax:- CDOW() Example:-? CDOW(date()) Output:- Monday Function returns: Character

(7)DOW():- DOW means Day of Week. This function returns the Numeric day value from the date expression. Foxpro display the day as set above in computer.(0 for Sunday and 6 for Saturday) Syntax:- DOW() Example:-? DOW(date()) Output:- 1 Function returns: Numeric

(2) Asc():- This function Returns the ASCII code for the leftmost character in a character express Syntax:- Asc() Example:- ?Second(‘a’) Output:- 97 Function returns:- Numeric

(3) Val():- This function Returns a numeric expression from a specified character expression composed of numbers. Syntax:- Val() Example:- d1=”55” Disp memo like d1 (oputput:-d1 Character ‘55’) D1=val(d1) Disp memo like d1 (oputput:-d1 Numeric 55 ) Function returns:- Numeric

(4) Str():- This function Returns the character string equivalent to a specified numeric express. Syntax:- Str() Example:- d1= Disp memo like d1 (oputput:-d1 Numeric 55 ) D1=Str(d1) Disp memo like d1 (oputput:-d1 Character ‘55’) Function returns:- Character

(5) Left:- This function Returns a specified number of characters from a character expression, starting with the leftmost character. Syntax:- Left(,) Example:- ?Left(‘computer’,4) Output:- comp Function returns:- Character

(6) Right:- This function Returns the specified number of rightmost characters from a char string. Syntax:- Right(,) Example:- ?Right(‘computer’,4) Output:- uter Function returns:- Character

( 7) Upper :- This function is use to convert specified character string in UPPERCASE format. Syntax:- Upper() Example:- ?Upper(‘computer’) Output:- COMPUTER Function returns:- Character

(8) Lower:- This function is use to convert specified character string in lowercase format. Syntax:- Lower() Example:- ?Lower(‘COMPUTER’) Output:- computer Function returns:- Character

(9) Proper:- This function is use to convert specified character string in Proper case format. Syntax:- Proper() Example:- ?Proper(‘this is a computer’) Output:- This Is A Computer Function returns:- Character

(10) Ltrim:- This function Returns the specified character expression with leading blanks removed. Syntax:- Ltrim() Example:- ?Ltrim(‘ computer’) Output:- computer Function returns:- Character

(11) Rtrim:- This function Returns the specified character expression with all trailing blanks removed. Syntax:- Rtrim() Example:- ?Rtrim(‘computer ’) Output:- computer Function returns:- Character

(12) Alltrim:- This function Returns the specified character expression with leading and trailing blanks removed. Syntax:- Alltrim() Example:- ?Alltrim(‘ computer ’) Output:- computer Function returns:- Character

(13) Isupper():- This function checks whether the first leftmost character of specified expression is in uppercase or not.If it find character in uppercase it return .t. else it return .f. as output. Syntax:- Is upper() Example:- ?Isupper(‘computer’) Output:- .f. Function returns:- Logical

(14) IsLower():- This function checks whether the first leftmost character of specified expression is in lowercase or not.If it find character in lowercase it return .t. else it return .f. as output. Syntax:- Islower() Example:- ?Islower(‘computer’) Output:- .t. Function returns:- Logical

(15) IsDigit():- This function checks whether the first leftmost character of specified expression is digit or not. If it find digit it return .t. else it return .f. as output. Syntax:- Isdigit() Example:- ?Isdigit(‘computer’) Output:- .f. Function returns:- Logical

(16) IsAlpha():- This function checks whether the first leftmost character of specified expression is an alphabetic character or not. If it find character as Alphabet it return .t. else it return .f. as output. Syntax:- Isalpha() Example:- ?Isalpha(‘computer’) Output:- .t. Function returns:- Logical

(16) Len():- This function Returns the number of characters in a character expression. Syntax:- Len() Example:- ?Len(‘computer’) Output:- 8 Function returns:- Numeric

(25) Inlist():- This function checks whether or not an expression matches one in a series of expressions of the same data type. INLIST( ) returns true if it finds the expression in the set of expressions. If it doesn't find the expression in the set of expressions, INLIST( ) returns false. Syntax:- Inlist, [, ...]) Example:- ?Inlist(5,10,15,25,35,45,5) Output:- .t. Function returns:- Logical

(26) Difference():- This function Returns an integer, 0 through 4, representing the relative phonetic difference between two character expressions. Syntax:- Difference(,) Example:- ?Difference(“rush”,”rooos”) Output:- 4 Function returns:- Numeric

(27) Padl():- This function Returns a character string from a character expression padded to a specify length. This function insert padding in leftside.If you not specify padded character computer padded by blank space. Syntax:- Padl(, [, ]) Example:- ?Padl(“Jay”,20,”_”) Output:- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ jay Function returns:- Character

(28) Padr():- This function Returns a character string from a character expression padded to a specify length. This function insert padding in right side. If you not specify padded character computer padded by blank space. Syntax:- Padr(, [, ]) Example:- ?Padr(“Jay”,20,””) Output:- jay _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Function returns:- Character

(29) Padc():- This function Returns a character string from a character expression padded to a specify length in center. This function insert padding in bothsize .If you not specify padded character computer padded by blank space. Syntax:- Padc(, [, ]) Example:- ?Padl(“Jay”,20,””) Output:- _ _ _ _ _ _ _ _ jay _ _ _ _ _ _ _ _ Function returns:- Character

Set Commands of FoxPro

Set command are one type of command which is defiantly set by the FoxPro when can change them means set them when we needed.

(1) Set alternate command:-

Set alternate command is use to save your printer output created with ?, ??, DISPLAY or LIST to a text file. Syntax:- SET ALTERNATE ON | OFF or SET ALTERNATE TO [ [ADDITIVE]] Default clause:- Off Set alternate to will create a new text file and stores the data into it. Example :- Set alternate on Set alternate to myfile Use student list set alternate off

Above example will create a new textfile name as my file and stores all the records of student database file

(2) Set carry command:- This function Determines whether or not FoxPro carries data forward from the current record to the new record created with APPEND or INSERT. This function is also helpful to carry forward only specific field. Syntax :- SET CARRY ON | OFF SET CARRY to Default clause:- Off Example:- Set carry on Set carry to class,city

(3) Set century command :- By default the date format of year is in two digit. If we want to display year format as ‘yyyy’ we can set the century command to ON mode. Syntax:- Set century ON|OFF Example:- Set century ON Default clause:- OFF

(4)Set color command :- This set command is useful to set Background color and text color in FoxPro. By default white is background color and black is text color is set. We must have to specified picture code of FoxPro which are following. B---blue N---Black G---Green W---White I --- Inverce BG---Cray GR---Brown N+---Gray RB ---magenta GRT---yellow

Syntax:- Set color to/ Example:- Set color r/G clear Default clause :- Default black textcolor is selected and white is background color. Above example will set Red as textcolor and Green as background color. We must have to type cleat command to see the output.

(5)Set Deleted command :- Set deleted command is use to specify whether or not FoxPro process on the records which are marked for deletion when set delete is on. FoxPro does process on marked records when commands like List, Display, Report.

Syntax:- Set Deleted ON | OFF Example:- Set Deleted ON Default clause:- OFF

(6)Set Device to command :- This set command is useful to set the output of @...say command to the specified device that is file, screen or printer. To screen option is use to set output in screen. File clause is use to save output in another textfile. specifies the name of file. Syntax:- SET DEVICE TO SCREEN | TO PRINTER | TO FILE Example:- Set device to screen Set device to myfile Default clause:- By default set default to screen is set.