2.50 2.50a
WINDOWS
kbprg kbfixlist kbbuglist
The information in this article applies to:
- Microsoft FoxPro for Windows, versions 2.5 and 2.5a
SYMPTOMS
Report variables initialized through a user-defined function (UDF) in a
self-referential fashion (for example, memvar = memvar + 1) return improper
values.
STATUS
Microsoft has confirmed this to be a problem in the Microsoft products
listed at the beginning of this article. This problem was corrected in
FoxPro 2.5b for Windows.
MORE INFORMATION
Steps to Reproduce Problem
- From the Command window or a program, execute the following code. It
will create two sample tables and indexes, populate them with data, and
set up a one-to-many relationship.
***Start sample code***
CLOSE DATABASES
SET SAFETY OFF
CREATE TABLE parent (id_num C(3))
INSERT INTO parent (id_num) VALUES ('001')
SELECT 0
CREATE TABLE child (id_num C(3) ,chld_total N(4,2))
INDEX ON id_num TAG id_num
FOR i=1 TO 5
INSERT INTO child (id_num, chld_total) VALUES ('001',i)
NEXT
SELECT parent
SET ORDER TO TAG id_num OF child.cdx IN child
SET RELATION TO id_num INTO child ADDITIVE
SET SKIP TO child
SET SAFETY ON
***End sample code***
- Create a report with the parent.id_num and child.chld_total fields in
the Detail band.
- Create a data grouping based on parent.id_num.
- Create a report variable with these properties:
Name: memvar
Value to store: memvar
Initial value: memvar + child.chld_total
Release after report: Checked
Reset: parent.id_num
Calculate: Nothing
- Create a Summary band and place a field in it based on memvar.
- Save the report and the environment and name the report SELF_REF.FRX.
NOTE: Saving the environment doesn't affect the behavior of the report.
- Issue the following commands in the Command window:
GO TOP
REPORT FORM self_ref.frx PREVIEW ENVIRONMENT
Note the value in the Summary band--it is 3 when it should be 1.
|