• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2183
  • Last Modified:

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

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.

1 Solution
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.
Olaf DoschkeSoftware DeveloperCommented:
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.
To update the field with blank you have to issue:

BLANK FIELD <FldName> [FOR <condition>]

But it really has restricted use.
Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

CREATE CURSOR test (logical L)
BROWSE FIELDS logical, isnull = ISBLANK(logical)
Olaf DoschkeSoftware DeveloperCommented:
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.
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.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now