Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need assistance with 'field validation'
Message
De
01/03/2003 03:25:19
 
 
À
28/02/2003 15:01:58
Mike Sue-Ping
Cambridge, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00759567
Message ID:
00759873
Vues:
17
Mike,

Dana's answer is correct. You either need mulitple case's or mulitple if's, ie each condition needs te be tested separately.
As for using the case, it's just a habit of mine. I use it when a whole series of things have to be done dependent on the outcome of the previous. So much more readable than nested If's. In a complex record validation it has the advantage of stopping the validation after the first inconsistency
local Success
Success = TRUE

do case
case !Success

case !validationrule_1
    Success = FALSE

case !validationrule_2
     Success = FALSE

otherwise
   pp = qq

endcase

do case
case !Success

case !validationrule_3
    Success = FALSE

case !validationrule_4
     Success = FALSE

otherwise
   yy= qq

endcase

...

return Success
>Hi Gregory.
>
>I guess my question now is, do I have to put every "case" into this record validation rule? I mean, if I have several fields that need some sort of validating, do I then need to build a case for each and every one of them and expand on the example you provided? Something like,
>
>do case
>case SomecheckHere
> repl field with SomeCalculatedValue
>
>case AnotherCheckHere
> repl field2 with SomeOtherCalculatedValue
>.
>.
>.
>case area <> Length * Width
> repl area with Length * Width
>.
>.
>.
>
>endcase
>
>TIA
>
>Mike
>
>>Mike,
>>
>>Put the code in the Record Validation rule
>>
>>do case
>>case area <> Length * Width
>>  repl  area with Length * Width
>>endcase
>>
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform