How I can find empty fields in my table ?

This sample test program scan any table records for empty fields in any type ,
and reports number of record(s) included empty field(s) with number of FIRST empty field.

#include <hmg.ch>

PROC MAIN

   SET( _SET_EOF, .F. )

   USE TEST

   nFldCount := FCOU()
   cTestFNam := "empties.txt"
   nEmptyRec := 0

   SET ALTERNATE TO (cTestFNam)
   SET ALTERNATE ON

   WHIL ! EOF()
      FOR nFld := 1 TO nFldCount
         IF EMPTY( FIELDGET( nFld ) )
            ? RECN(), nFld
            ++nEmptyRec
            EXIT
         ENDI
      NEXT
      SKIP
   ENDD

   SET ALTE OFF
   SET ALTE TO
   MsgBox( LTRIM( STR( RECC() ) ) + " records with " +; 
           LTRIM( STR( nFldCount ) ) + " field(s) scanned ;" +;
           CRLF + ;
           LTRIM( STR( nEmptyRec ) ) + ;
           " records found with empty field." )

   EXECUTE FILE "NOTEPAD.EXE" PARAMETERS cTestFNam
RETU

One response to “How I can find empty fields in my table ?

  1. Pingback: How I Can Do … | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.