How to update a Field of Logical Datatype with BLANK in VFP 6.0

Posted on 2012-09-11
Last Modified: 2012-09-28
Hello Experts,

I'm Importing the data from Excel and when I try that I get False as Default for one of my Logical Field. I need it to be BLANK instead.

Question by:ASPDEV
    LVL 3

    Expert Comment

    Logical data type variables can only be true or false.

    If you want to display a blank when the value is false, you will have to use a form or report control that will display a blank when the control value is false.

    If you are talking about just browsing data, then you can use a computed field in the browse definition to display a blank when a field is false.
    LVL 29

    Expert Comment

    by:Olaf Doschke
    Querying a logical field results in .F. for blank fields. The only way to retrieve a blank status is by testing ISBLANK(field). But if you put that into a query, a blank field results in .F.

    If you want to do a 4 value logic, use a C(1). L fields also use 1 Byte each, even if you have several logical fields.

    Bye, Olaf.
    LVL 41

    Expert Comment

    To update the field with blank you have to issue:

    BLANK FIELD <FldName> [FOR <condition>]

    But it really has restricted use.
    LVL 27

    Accepted Solution

    CREATE CURSOR test (logical L)
    BROWSE FIELDS logical, isnull = ISBLANK(logical)
    LVL 29

    Expert Comment

    by:Olaf Doschke
    Let's put this straight: I wonder if you really get .F. as a default from importing from excel. If you test with Isblank in a query or also if you ? field or scatter memvar and ?m.field you get .F. as output, even if the field really is blank.

    Pavel is right BLANK does blank a field, and Cyril is right that you can use BROWSE with an extended field defined via Fields caluse as he shows.

    But if you query that later via ASP (as your user name suggests), then you go with the sql engine and probably have no chance to make that difference of blank values anyway and should move to C(1) fields instead, perhaps, eg with N,B,F,T in them or 0-3. And if you move that way, you have to change Excel import anyway.

    I wonder if cells of an excel table )with a whole column marked as logical) can even be blank. Of course each cell of a sheet can be any type, but then it's not a table anyway. If youu have an excel table with blank cells and true and false display, that's most probably not in a column with a fixed type, but a column with individual cell values. Such sheets are not easy to import anyway, as they don't really resemble a database table, just a tabular layout of mixed data. You can interpret that more or less stringent, if at least all non blank fields are the same type, but I'd rather make use of NULL instead of blank, if that is the case.

    Bye, Olaf.
    LVL 27

    Expert Comment

    In cases when there is an unassigned value, I second Olaf by using Null values and check for them using ISNULL which is more professional than the blank and the null is a standard in databases.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
    Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now