Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Empty ( )
Message
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01226547
Message ID:
01226569
Vues:
18
The code seems OK to me. Are you sure you're on the right ALIAS() and you're scanning the right table?

Also perhaps you need to write the information in the log file instead of a messagebox. Also perhaps you need to log the info about bad record.

See the changes I made in the code.

>The code below shows some erros message
>When I edit the record, the field is not empty
>
>
>
local lcLogFile as Character, llEmpty as Logical, lnFields as Integer, lnI as Integer
local array laFields[1]
#define CRLF chr(13) + chr(10)

lcLogFile = "c:\Temp\LogFile.txt"
select certificados

>SCAN FOR cert_pt = 0
>llEmpty = .f.
>
>DO CASE
>
>CASE EMPTY(certificados.nome_cert)
>
>*= MESSAGEBOX("Campo NOME_CERT vazio na ficha do aluno: " + STR(COD))
>N_ERROS = N_ERROS + 1
  llEmpty = .t.
>
>CASE EMPTY(certificados.curso)
>*= MESSAGEBOX("Campo CURSO vazio na ficha do aluno: " + STR(COD))
>N_ERROS = N_ERROS + 1
>llEmpty = .t.
>CASE EMPTY(certificados.data_curso)
>*= MESSAGEBOX("Campo DATA vazio na ficha do aluno: " + STR(COD))
>N_ERROS = N_ERROS + 1
>llEmpty = .t.
> CASE EMPTY(certificados.horas)
> *= MESSAGEBOX("Campo HORAS vazio na ficha do aluno: " + STR(COD))
>N_ERROS = N_ERROS + 1
>llEmpty = .t.

>
>CASE empty(certificados.nome)
* = MESSAGEBOX("Campo NOME vazio na ficha do aluno: " + STR(COD))
>N_ERROS = N_ERROS + 1
>llEmpty = .t.

>CASE EMPTY(certificados.end)
* = MESSAGEBOX("Campo ENDEREÇO vazio na ficha do aluno: " + STR(COD))
>N_ERROS = N_ERROS + 1
>llEmpty = .t.

>
>CASE EMPTY(certificados.cidade)
*= MESSAGEBOX("Campo CIDADE vazio na ficha do aluno: " + STR(COD))
>N_ERROS = N_ERROS + 1
>llEmpty = .t.

>
>CASE EMPTY(certificados.EST)
*= MESSAGEBOX("Campo CIDADE vazio na ficha do aluno: " + STR(COD))
>N_ERROS = N_ERROS + 1
>llEmpty = .t.

>
>CASE EMPTY(certificados.CEP)
*= MESSAGEBOX("Campo CEP vazio na ficha do aluno: " + STR(COD))
>N_ERROS = N_ERROS + 1
llEmpty = .t.

>ENDCASE

> if m.llEmpty && We do have empty fields
     lnFields = afields(laFields)
     for lnI = 1 to m.lnFields
        strtofile("Record " + trasform(recno()) + " has empty information: " + CRLF + ;
       laFields[m.lnI,1]+ " = " + transform(evaluate(laFields[m.lnI,1])) + CRLF,m.lcLogFile,1) && Add info about the bad record into the log file
  endif


>ENDSCAN
modify file (m.lcLogFile)
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform