FIX: CREATE REPORT on SELECT-SQL Cursor Uses Original Fields

ID: Q118292

2.60 WINDOWS kbprg kbfixlist kbbuglist

The information in this article applies to:

SYMPTOMS

After you issue a SELECT-SQL statement in FoxPro version 2.6 for Windows and limit the fields that end up in the new table or cursor, running the CREATE REPORT command on the newly created table or cursor brings up all the fields from the original table. This behavior occurs even when the original table is closed. This behavior cannot be duplicated in any other version of FoxPro.

CAUSE

This problem only occurs when there are no additional clauses (such as WHERE or HAVING) on the SELECT statement.

RESOLUTION

To work around this problem, add a WHERE, HAVING, ORDER BY, or GROUP BY clause to the SELECT statement. If you don't need a clause, add WHERE .T. to the end of the SELECT statement; for example:

   SELECT customer.cno, customer.state;
      FROM customer;
      INTO CURSOR test WHERE .T.
   CREATE REPORT test.frx FROM test WIDTH 788
   REPORT FORM test.frx PREVIEW

The above code works correctly and will display only two fields in the preview: CNO and STATE.

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 version 2.6a for Windows.

MORE INFORMATION

Steps to Reproduce Behavior

Execute the following commands:

   SELECT customer.cno, customer.state;
      FROM customer;
      INTO CURSOR test
   CREATE REPORT test.frx FROM test WIDTH 788
   REPORT FORM test.frx PREVIEW

All the fields from CUSTOMER.DBF will be displayed in the preview. If you were to open the report, you would see that all the fields from CUSTOMER are included. If you check the expression, you will see that it does not include the alias, but the table listed in the popup at the bottom will be TEST. The expression evaluates to TRUE, which would lead you to believe that the fields actually all ended up in TEST. However, if you browse TEST, it will contain only the two fields specified.

Additional reference words: FoxWin 2.60 buglist2.60 fixlist2.60a relational query by example database RQBE quick report KBCategory: kbprg kbfixlist kbbuglist KBSubcategory: FxtoolRqbe

Keywords          : FxtoolRqbe kbbuglist kbfixlist
Version           : 2.60
Platform          : WINDOWS
Solution Type     : kbfix

Last Reviewed: October 22, 1997