PRB: APPEND FROM to Logical Field Loads Literal t or y Values

Last reviewed: December 14, 1995
Article ID: Q141145
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 3.0

SYMPTOMS

Using the the following command saves literal "t" and "y" values as false in a logical field:

   APPEND FROM <textfile> TYPE DELIMITED

CAUSE

The APPEND FROM command does not recognize lowercase "t" or "y" as valid logical values.

RESOLUTION

Change the table structure of the logical field to a character field. After appending the records to the table, change the structure of the character field back to a logical field.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce & Resolve Behavior

The following program converts all the logical fields in a table to character fields. Records are appended to the table from a text file. All of the records in character field are converted to uppercase and switched back to logical field type.

  1. Create a new text file called Mytext.txt. There should be no spaces, tabs, or periods on each line. Type the following exactly as shown:

    T F t f Y y N n

  2. Open a program file and type the following lines of code into it:

    CREATE TABLE TABLE1 (FIELD1 L) DIMENSION laMyarray(fcount()) laMyarray=.F. FOR lnI = 1 TO FCOUNT()

          IF TYPE(FIELD(lnI)) = "L"
    
             laMyarray(lnI)=.T.
             lcFld=FIELD(lnI)
             ALTER TABLE TABLE1 ALTER COLUMN &lcFld c(1)
          ENDIF
       ENDFOR
       APPEND FROM mytext.txt TYPE DELIMITED
       FOR lnI=1 to FCOUNT()
          IF laMyarray(lnI)
             lcFld=FIELD(lnI)
             REPLACE ALL &lcFld WITH UPPER(&lcFld)
             ALTER TABLE TABLE1 ALTER COLUMN &lcFld L
          ENDIF
       ENDFOR
    
    

  3. Save and close the program.

  4. In the Command window, type:

    DO <Myprogram> BROWSE

    Notice that the logical fields now correctly display T or F.


Additional reference words: 3.00 VFoxWin
KBCategory: kbprg kbprb kbcode
KBSubcategory: FxprgTable


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: December 14, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.