FIX: Report Variables Return Incorrect Values

Last reviewed: October 14, 1997
Article ID: Q107555
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

  1. 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***
    
    

  2. Create a report with the parent.id_num and child.chld_total fields in the Detail band.

  3. Create a data grouping based on parent.id_num.

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

  5. Create a Summary band and place a field in it based on memvar.

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

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


Additional reference words: FoxWin 2.50 2.50a buglist2.50a
fixlist2.50b
KBCategory: kbprg kbfixlist kbbuglist
KBSubcategory: FxprgGeneral
Keywords : FxprgGeneral kbbuglist kbfixlist kbprg
Version : 2.50 2.50a
Platform : WINDOWS
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 14, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.