"Syntax Error" When Verifying UDF() in Report WriterID: Q113754 2.00 2.5x 2.6x | 2.5x 2.6x 3.00 | 2.5x 2.60a
The information in this article applies to:
SUMMARYWhen you are verifying an user-defined function (UDF) in the Expression Builder, a "Syntax Error" appears. The "Syntax Error" message occurs because the Expression Builder cannot evaluate UDFs and expects instead to find an internal function. However, if the UDF() function exists as a stand-alone .PRG file and has previously been tested, the function will operate properly in a report when the report is previewed or printed.
MORE INFORMATIONA UDF is a program routine that must always return a value of some type. It can be created in two forms: external and internal. An internal function is a subroutine within a .PRG file, and its name must be preceded with the FUNCTION statement. An external function is a single .PRG file, with a maximum of eight characters for its name. The external form must be used so that the Report Writer can find it as a stand-alone .PRG file in the default directory or SET PATH list (SET PROCEDURE TO is not evaluated). Once you have created the function, you can test the function by invoking it from the Command window or from within a program. In the following example, a function to print a time stamp (minute resolution) on each record is needed. To do this, create the file STAMP.PRG, which contains this single line:
This function returns the number of seconds since midnight divided by 60 to
show the number of minutes (no decimals), concatenated with the modulus of
SECONDS to show the remainder of seconds and hundredths of seconds. To test
this function, type the following commands in the Command window:
FoxPro should return a character string consisting of the minutes, a colon,
the seconds, a decimal point, and the hundredths of seconds. Although the
function name is STAMP, it must be invoked as STAMP() to cause FoxPro to
look for an internal function of the same name. When it cannot be found,
FoxPro will then look externally for a file with the same name.
After the function has been successfully tested, you can use it in the report. To use the function, create a field on the report and enter the name of the function followed by a left and right parentheses, as shown in the test above. Additional reference words: VFoxWin 3.00 FoxMac FoxDos FoxWin 2.00 2.10 2.50 2.50a 2.50b 2.50c 2.60 2.60 calculate report variable RWriter KBCategory: KBSubcategory: FxtoolRwriter
|
Last Reviewed: May 22, 1998 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |