1 / 75

Function : Specifies the default drive and directory . Syntax : SET DEFAULT TO [ cPath ]

Function : Specifies the default drive and directory . Syntax : SET DEFAULT TO [ cPath ]. cPath . S pecifies one of the following: A drive designator A drive designator with a directory name A child directory name

braden
Download Presentation

Function : Specifies the default drive and directory . Syntax : SET DEFAULT TO [ cPath ]

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Function: Specifies the default drive and directory. • Syntax: SET DEFAULT TO [cPath]

  2. cPath. Specifies one of the following: • A drive designator • A drive designator with a directory name • A child directory name • Any of the above using Microsoft MS-DOS shorthand notation ( \ or ..)

  3. SET DEFAULT changes the default directory to the directory you specify. • Microsoft® Visual FoxPro® searches for a file in the default Visual FoxPro directory. The default directory is the one from which you start Visual FoxPro. However, you can specify a different default directory in your Visual FoxPro configuration file or in a startup program.

  4. If Visual FoxPro cannot find a file in the default directory, it then searches the Visual FoxPro path if one has been specified. Use SET PATH to specify the Visual FoxPro path. • If you create a file and do not specify where to place it, the file is placed in the default Visual FoxPro directory.

  5. The SET DEFAULT command is not supported in either single or multithreaded DLL servers. This command changes the default directory of the entire process, so all threads which are part of the process are affected. Use the SET PATH command in DLL servers, in place of CD and CHDIR.

  6. SYS(5) returns the default drive. • SYS(2003) returns the default directory with no drive designator. • SYS(5) + SYS(2003) returns the default drive and the directory.

  7. Set Default to D && Changes default drive to D Set Default to D: && Changes default drive to D Set Default to D:\Bruno\Exercises Set Default to D:\Bruno && Specifies a specific directory Set Default to Exercises && Changes the default directory to D:\Exercises if the root directory on drive D is the default directory of Visual Foxpro. Note: && indicates the start of an inline comment.

  8. Set Default to \ && Makes the root directory the default directory – that is, if the current directory is other than the root directory (e.g., D:\Bruno\Exercises) Set Default to .. && Moves the default directory one level (up) towards the root directory.

  9. Function: Opens the Table Designer so you can create a Visual FoxPro table. • Syntax: Create [filename│?]

  10. [ FileName|?] Specifies the name of the table to create or opens the Create dialog box so you can browse for a location to save the table and specify the name of the table to create. • If FileNameis specified, it opens the Table Designer so you could define the fields and their attributes in the table. • If ? is used, it opens the Createdialog box so you can browse for a location to save the table and specify the name of the table to create.

  11. 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 (->).

  12. 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. • The SQL CREATETABLEcommand makes it possible to specify fields and their attributes programmatically. For more information, see CREATE TABLE - SQL Command.

  13. Set Default to F:\Bruno Create Students Set Default to D:\Bruno Create ?

  14. Function: Adds one or more new records to the end of a table. • Syntax: APPEND [BLANK] [IN nWorkArea | cTableAlias] [NOMENU]

  15. BLANKadds 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 BROWSE, CHANGE, or EDIT. INnWorkAreaspecifies the work area of the table to which a new record is appended.

  16. IN cTableAliasspecifies the alias of the table to which a new record is appended. If you omit nWorkArea and cTableAlias, a new record is appended to the table in the currently selected work area. If you issue APPEND, a blank record is added to the table you specify with nWorkArea or cTableAlias and the table is automatically selected. If you issue APPEND BLANK, a blank record is added to the table you specify with nWorkArea or cTableAlias and the table is not selected.

  17. NOMENU specifies that the Table menu title is removed from the system menu bar, preventing changes to the format of the editing window.

  18. Function: Marks records for deletion. • Syntax: DELETE [Scope] [FOR lExpression1] [WHILE lExpression2] [IN nWorkArea | cTableAlias] [NOOPTIMIZE]

  19. Scope.Specifies a range of records to mark for deletion. The default scope for DELETE is the current record (NEXT 1). The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST. For more information on scope clauses, see Scope Clauses.

  20. FOR lExpression1. Specifies a condition whereby only the records that satisfy the logical condition lExpression1 are marked for deletion. Rushmore Query Optimization optimizes a query created with DELETE ... FOR if lExpression1 is an optimizable expression and the table is indexed on DELETED( ). For best performance, use an optimizable expression in the FOR clause. For information on Rushmore optimizable expressions, see SET OPTIMIZE, and Using Rushmore Query Optimization to Speed Data Access in Optimizing Applications.

  21. WHILE lExpression2. Specifies a condition whereby records are marked for deletion for as long as lExpression2 evaluates to true (.T.). IN nWorkArea. Specifies the work area of the table in which records are marked for deletion.

  22. IN cTableAlias. Specifies the alias of the table in which records are marked for deletion. If you omit nWorkArea and cTableAlias, records are marked for deletion in the table in the currently selected work area. NOOPTIMIZE.Disables Rushmore optimization of DELETE.

  23. 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.

  24. The following example opens the Customer table in the TestDatadatabase. DELETEis used to mark all records for deletion where the Countryfield contains USA. All the records marked for deletion are displayed. RECALL ALL is used to unmark all records marked for deletion.

  25. CLOSE DATABASES OPEN DATABASE (HOME(2) + 'Data\testdata') USE customer && Opens Customer table DELETE FOR country = 'USA' && Marks for deletion CLEAR LIST FIELDS company, country FOR DELETED( ) && Lists marked records RECALL ALL && Unmark all records marked for deletion.

  26. Function: Specifies a path for file searches. • Syntax: SET PATH TO [Path] [ADDITIVE]

  27. TO [Path] specifies the directories you want Visual FoxPro to search. Use commas or semicolons to separate the directories. [ADDITIVE] appends additional paths to the end of the current path.

  28. Visual FoxPro will not recognize a path name properly if a disk or directory name contains an exclamation point (!) • On all FoxPro platforms, functions that return path information, such as CURDIR( ), DBF( ), and SYS(2003), use Microsoft MS-DOS path-naming conventions in their return values.

  29. Issue SET PATH TO without Path to restore the path to the default directory. Use SET DEFAULT to specify the default directory and CURDIR( ) to return the current default directory. • SET PATH is not scoped to the current data session; changes you make to the default path using the SET PATH command affect all data sessions. • SET PATH is limited to a maximum of 4095 characters. • When using the ADDITIVE parameter, paths must be included either as a quoted string or valid expression.

  30. ff= [“Bruno3"] SET PATH TO &ffADDITIVE ** or ** ff= “Bruno3“ SET PATH TO '&ff' ADDITIVE Note:* indicates the start of a line comment.

  31. Function: Moves the record pointer to the specified record number. • Syntaxes: • GO [RECORD] nRecordNumber [IN nWorkArea | IN cTableAlias] • GO TOP | BOTTOM [IN nWorkArea | IN cTableAlias] • GOTO [RECORD] nRecordNumber [IN nWorkArea | IN cTableAlias] • GOTO TOP | BOTTOM [IN nWorkArea | IN cTableAlias]

  32. RECORD nRecordNumber. Specifies the physical record number to move the record pointer to. You can omit GO or GOTO entirely and specify just the record number. If you specify just the record number, you can move the record pointer only within the current work area. • IN nWorkArea. Specifies the work area of the table in which the record pointer is moved.

  33. IN cTableAlias. Specifies the alias of the table in which the record pointer is moved. • TOP. Positions the record pointer on the first record in the table. If the table has an ascending index in use, the first record is the record with the lowest key value. If the index is in descending order, the first record is the record with the highest key value.

  34. Parameters … • BOTTOM. Positions the record pointer on the last record in the table. If the table has an ascending index in use, the last record is the record with the highest key value. If the index is in descending order, the last record is the record with the lowest key value.

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

  36. CLOSE DATABASES OPEN DATABASE (HOME(2) + 'data\testdata') USE products && Opens Products table USE customer IN 0 && Opens Customer table GO BOTTOM IN products CLEAR ? RECNO('products') GO TOP ? RECNO( ) && Displays 1 GO 5 ? RECNO( ) && Displays 5

  37. Function: Evaluates expressions and sends the results to the main Visual FoxPro window, an active user-defined window, or the printer. • Syntax: • ? | ?? Expression1 [PICTURE cFormatCodes] | [FUNCTION cFormatCodes] | [VnWidth] [AT nColumn] [FONT cFontName [, nFontSize [, nFontCharSet]] [STYLE cFontStyle | Expression2]] [, Expression3] …

  38. ? Expression1. Evaluates the expression specified by Expression1 and sends a carriage return and line feed preceding the expression results. The results display on the next line of the main Visual FoxPro window or the active user-defined window and are printed at the left margin of a page unless a function code specified by cFormatCodes or the _ALIGNMENT system variable specifies otherwise.

  39. If you omit the expressions, a blank line is displayed or printed. A space is placed between expression results when multiple expressions are included. If Expression1 is an object, the ? command returns the character string, "(Object)".

  40. ?? 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, an active user-defined window, or the printer. A carriage return and line feed are not sent before the results.

  41. PICTURE cFormatCodes. Specifies a picture format in which the result of Expression1 is displayed. cFormatCodes can consist of function codes, picture codes, or a combination of both. You can use the same codes available in the Format Property and InputMask Property. Function codes affect the overall format of the result; picture codes act on individual characters in the result.

  42. If function codes are used in cFormatCodes, they must appear before the picture codes and they must be preceded by an at (@) sign. Multiple function codes with no embedded spaces can immediately follow the @ sign. The last function code must be followed by one or more spaces. The space or spaces signal the end of the function codes and the start of the picture codes.

  43. FUNCTION cFormatCodes. Specifies a function code to include in the output from the ? and ?? commands. If the function clause is included, do not precede the function codes with an @ sign. Function codes must be preceded by a @ sign when included in PICTURE.

  44. V nWidth. Specifies a special function code that enables the results of a character expression to stretch vertically within a limited number of columns. nWidth specifies the number of columns in the output. ? 'This is an example of how the V function code works.' ; FUNCTION 'V10'

  45. AT nColumn. Specifies the column number where the output is displayed. This option makes it possible for you to align output in columns to create a table. The numeric expression nColumn can be a user-defined function that returns a numeric value.

  46. FONT cFontName[, nFontSize [, nFontCharSet]]. Specifies a font for output by the ? or ?? command. cFontName specifies the name of the font, and nFontSize specifies the point size. You can specify a language script with nFontCharSet. See the GETFONT( ) Function for a list of available language script values. For example, the following command displays the system date in 16-point Courier font:

  47. FONT cFontName[, nFontSize [, nFontCharSet]]. Specifies a font for output by the ? or ?? command. cFontName specifies the name of the font, and nFontSize specifies the point size. You can specify a language script with nFontCharSet. See the GETFONT( ) Function for a list of available language script values. For example, the following command displays the system date in 16-point Courier font: • ? DATE( ) FONT 'Courier',16

  48. If you include the FONT clause but omit the point size nFontSize, a 10-point font is used. If you omit the FONT clause, and output for the ? or ?? command is placed in the main Visual FoxPro window, the main Visual FoxPro window font is used for the output. If you omit the FONT clause, and output for the ? or ?? command is placed in a user-defined window, the user-defined window font is used for the output.  Note: If the font you specify is not available, a font with similar font characteristics is substituted.

  49. Function: Sends output directly to the printer. • Syntax: • ??? cExpression

More Related