ERR: Unable to Find Unknown <Array> When <Array> Is in Report
PSS ID Number: Q111673
Article last modified on 02-18-1994

2.50 2.50a 2.50b | 2.00 2.50 2.50a 2.50b

WINDOWS          | MS-DOS


--------------------------------------------------------------------
The information in this article applies to:

 - Microsoft FoxPro for Windows, versions 2.5, 2.5a, and 2.5b
 - Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, 2.5a, and 2.5b
--------------------------------------------------------------------

SYMPTOMS
========

When you are building an application, it is not uncommon to receive a
warning dialog box that indicates that FoxPro was unable to find a
particular program, menu, report, or array. This error is often caused by a
report that calls an array.

CAUSE
=====

When this compiler error occurs, the EXTERNAL command is normally used to
resolve this issue. According to the online help file, an array should be
declared EXTERNAL under the following circumstances:

 - When an array is created in an upper-level program and is used in a
   lower-level program.

      Sample Code
      -----------

      DIMENSION invoice(4)
      STORE 'Paid' to invoice
      DO dispinv

      ** Procedure that uses the array called invoice ***

      PROCEDURE dispinvo
      EXTERNAL ARRAY invoice
      ? invoice(1)
      ? invoice(2)
      ? invoice(3)
      ? invoice(4)
      RETURN

 - When passing an array to a user-defined function (UDF) or procedure.

      Sample Code
      -----------

      DIMENSION firstarray(2)
      EXTERNAL ARRAY arraytwo
      SET TALK OFF
      STORE 10 to firstarray(1)
      STORE  2 to firstarray(2)
      =ADDTWO(@firstarray)

      FUNCTION addtwo
      PARAMETERS arraytwo
      CLEAR
      arraytwo(1) = arraytwo(1) + 2
      arraytwo(2) = arraytwo(2) + 2
      ? arraytwo(1)
      ? arraytwo(2)
      RETURN

When a report calls an array, the array is always EXTERNAL to the report.
There is no way to fully implement either of the above methods because we
cannot modify the code that is created to produce the report.

RESOLUTION
==========

One possible resolution to this issue is to create a dummy procedure or
function with the same name as the array that is called in the report. This
procedure should never be called and should have no more than a RETURN
statement. However, its existence will make the compiler quit looking for
the array inside the report. In any instance where the array name is used,
the FoxPro compiler will assume that we are making a call to the dummy
procedure and not to an array that exists elsewhere. This will have no
effect on the compiled application and the report will call the array as
expected.

Additional reference words: 2.00 2.50 2.50a 2.50b unknown array report
error message errmsg err msg

=============================================================================

Copyright Microsoft Corporation 1994.
