How to Determine Whether a Record Is Blank or EmptyID: Q137410 The information in this article applies to:
SUMMARYFoxPro supplies functions to determine if the contents of a single field is blank (with ISBLANK()) or empty (with EMPTY()). This article will show how to use these functions to create user-defined functions (UDFs) that will return True (.T.) or False (.F.) to indicate if the entire record is blank or empty. For more information about the ISBLANK() function, please see the FoxPro Help file or the following articles in the Microsoft Knowledge Base:
MORE INFORMATIONCreate a program/procedure file containing the following UDF:
This function tests to see if it needs to change work areas by the number
of parameters passed to the UDF. It then loops through all the fields in
the current work area, testing each field with the ISBLANK() function. The
first field that returns NOT BLANK causes the memory variable llResult to
be set to false (.F.) and exits the For loop. If necessary, the UDF changes
back to the original work area and then return the results of the search
for blank fields. If all fields in the record are blank, the UDF returns
True (.T.).
NOTE: To test for an empty record, you may change the name of the function to IsEmptyRec and replace the following line:
with:
Testing the Results1. Place both functions in a .prg file. 2. In the Command window, type the following where <myproc> is the name of 3. Open the Customer.dbf file located in the Tutorial directory, located
4. While on record number 1, enter the following command in the Command
5. Type the command APPEND BLANK in the Command window.
6. While on the new record, enter the following command in the Command 7. Edit the new record by entering zeros in the fields: Ytdpurch, Lat, and
8. While on the new record, enter the following command in the Command
Additional reference words: FoxWin FoxDos 2.50 2.50a 2.50b 2.60 2.60a
KBCategory: kbprg kbcode
KBSubcategory: FxprgGeneral
|
|
Last Reviewed: September 29, 1995 © 1999 Microsoft Corporation. All rights reserved. Terms of Use. |