Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What Column am I In?
Message
De
25/08/2000 04:13:13
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00406230
Message ID:
00409108
Vues:
54
>It almost worked....
>
>Here's what I tried:
>
>I put colrule(varread()) in the Field Validation Rule of column ADDRESS_LINE_ONE_TX, and colrule.prg looks like this:
>
>  parameter cColName
>  cValue = proper(eval(cColName))
>  do case
>    case cColName = 'ADDRESS_LINE_ONE_TX'
>    ? 'Column Name - ' + proper(cColName)
>    ? 'Column Value - ' + cValue
>    replace &cColName with cValue
>  endcase
>return .t.
>
>When I make a change in the column, I now get an endless loop. I think VFP is constantly replacing the field. Can you think of a way to make it just replace once?
>
>Thanks more!


Replace is causing field validation to retrigger. One way to prevent is to check value and do no replace if it satisfies as Cheryl suggested already. In that case at most 2 levels of procedure calls would occur.
OTOH at times data needs to be validated based on more than one field. And as I understand you want to do silent validation-correction behind the scenes. Then use table validation. You wouldn't need varread then. Something like this :
* Stored procedure
* Table validation for Table1 : myTable1CheckRow() 
function myTable1CheckRow
local ix
scatter name oVerifier
for ix=1 to fcount()
 myTable1ColCheck(field(ix))
endfor
gather name oVerifier
* Further rowwise check

function myTable1ColCheck
lparameters tcColName
do case
 case inlist(tcColName,'FIRST_NAME','LAST_NAME','TITLE')
  store proper(eval('oVerifier.'+tcColName)) to ('oVerifier.'+tcColName)
*....
 otherwise
*...
endcase
If nonbuffered would fire with every field change but would benefit in buffering modes and called once per row change.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform