EXTERNAL Command

See Also

Alerts the Project Manager to an undefined reference.

Syntax

EXTERNAL FILE FileList | ARRAY ArrayList
  | CLASS | FORM | LABEL | LIBRARY | MENU
  | PROCEDURE | QUERY | REPORT | SCREEN | TABLE

Arguments

FILE FileList

Specifies that the file you include in an indirect file reference or macro substitution is a stand-alone file, such as a text file, .BMP bitmap file, and so on. FileList may contain a list of file names separated by commas.

ARRAY ArrayList

When an array is created in a program and then used in a lower-level program, include ARRAY with the array name in the lower-level program. ArrayList may contain a list of array names separated by commas.

In the following example, the first program creates an array named gaInvoice. The array is initialized and a lower-level program named dispinvo is called. dispinvo displays the contents of the array created in the higher-level program. The command EXTERNAL ARRAY GAINVOICE is included to alert the Project Manager.

DIMENSION gaInvoice(4)
STORE 'Paid' TO gaInvoice
DO dispinvo
*** Program dispinvo ***
PROCEDURE dispinvo
EXTERNAL ARRAY gaInvoice
? gaInvoice(1)
? gaInvoice(2)
? gaInvoice(3)
? gaInvoice(4)
RETURN
*** End of dispinvo program ***

When an array is passed to a user-defined function or procedure, the corresponding array in the user-defined function or procedure must be identified to the Project Manager. Include the ARRAY option with the name of the array included in the PARAMETER statement.

DIMENSION gaArrayOne(2)      && Create an array
EXTERNAL ARRAY gaArrayTwo   && Name of the array used in the UDF
SET TALK OFF
STORE 10 TO gaArrayOne(1)
STORE  2 TO gaArrayOne(2)
= ADDTWO(@gaArrayOne)      && Pass the array by reference to a UDF
FUNCTION ADDTWO
PARAMETER gaArrayTwo
CLEAR
gaArrayTwo(1) = gaArrayTwo(1) + 2
gaArrayTwo(2) = gaArrayTwo(2) + 2
? gaArrayTwo(1)
? gaArrayTwo(2)

CLASS

Specifies that the file you include in an indirect file reference or macro substitution is a visual class library.

EXTERNAL CLASS myvclass  && CLASS myvclass must exist
STORE 'myvclass' TO gcClassFile
MODIFY CLASS (gcClassFile)

FORM

If a Form definition file is included in an indirect file reference or macro substitution, include FORM and the Form file name. FORM is identical to SCREEN.

EXTERNAL FORM dataentr  && FORM dataentr must exist
STORE 'dataentr' TO gcFormFile
DO FORM (gcFormFile)

LABEL

Specifies that the file you include in an indirect file reference or macro substitution is a label definition file.

EXTERNAL LABEL Maillabl     && LABEL FORM Maillabl must exist
STORE 'Maillabl' TO gcLabelFile
LABEL FORM (gcLabelFile) PREVIEW 

LIBRARY

Include LIBRARY when a library file is referenced by indirect file referencing or macro substitution in SET LIBRARY.

EXTERNAL LIBRARY regress  && LIBRARY regress must exist
STORE 'regress' TO gcStatFunc
SET LIBRARY TO (gcStatFunc)

MENU

If a menu definition file is included in an indirect file reference or macro substitution, include MENU and the menu file name.

EXTERNAL MENU pickfile  && MENU pickfile must exist
STORE 'pickfile' TO gcSysMenPad
MODIFY MENU (gcSysMenPad)

PROCEDURE

Identifies an external procedure or user-defined function.

EXTERNAL PROCEDURE delblank     && PROCEDURE delblank must exist
STORE 'delblank' TO gcTrimBlanks
DO (gcTrimBlanks) WITH 'A B C D E'

QUERY

Specifies that the file you include in an indirect file reference or macro substitution is a query file.

EXTERNAL QUERY sales  && QUERY sales must exist
STORE 'sales.qpr' TO gcSalesFile
DO (gcSalesFile)

REPORT

Specifies that the file you include in an indirect file reference or macro substitution is a report definition file.

EXTERNAL REPORT overdue     && REPORT overdue must exist
STORE 'overdue' TO gcReportFile
REPORT FORM (gcReportFile) PREVIEW

SCREEN

If a form definition file is included in an indirect file reference or macro substitution, include SCREEN and the screen file name. SCREEN is identical to FORM.

EXTERNAL SCREEN dataentr  && SCREEN dataentr must exist
STORE 'dataentr' TO gcScreenFile
MODIFY SCREEN (gcScreenFile)

TABLE

Specifies that the file you include in an indirect file reference or macro substitution is a Visual FoxPro table.

EXTERNAL TABLE customer && Table customer must exist
STORE 'customer' TO gcMyTable
USE (gcMyTable)

Remarks

Use EXTERNAL to include files and to resolve undefined references in a project created by the Project Manager. EXTERNAL is used only by the Project Manager and is ignored during program execution.

For more information on creating projects with the Project Manager, see "Using the Project Manager" in Chapter 15, Compiling an Application, in the Programmer's Guide.

Files whose names you specify with EXTERNAL are included in a project by the Project Manager. You must include CLASS, FILE, FORM, LABEL, LIBRARY, MENU, PROCEDURE, QUERY, REPORT, SCREEN, or TABLE before the file name or a set of file names separated with commas to tell the Project Manager the type of files to include in the project.

The Project Manager must also be alerted to file names contained in a name expression or macro substitution. This ensures that all necessary files are included in a project when the project is built. It must also be alerted to arrays that are created in another procedure or user-defined function.

For more information on name expressions and macro substitution, see the & command. Whenever possible, use a name expression instead of macro substitution to improve performance.