Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cursorgetprop('Fields')
Message
De
03/04/2002 12:57:17
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Cursorgetprop('Fields')
Divers
Thread ID:
00640440
Message ID:
00640440
Vues:
54
In a view:
Can any one think of a way to get a list of the fields that have a check mark next to them in the "Update Criteria" tab of the view designer?
CURSORGETPROP('UpdatableFieldList') and ('UpdateNameList') provide lists of all the fields.

I'm thinking of trying this. Hopefully this will give someone some ideas and they'll respond.

The logic here is that only those fields that have a check mark next to them will trigger a rule validation during TABLEUPDATE() of a new record. So intercept the validation rule in the underlying DBFs and get the field names.
To Intercept the validation rule replace the RuleExpression with a UDF() that gather field names. After getting the field list put the original RuleExpressions back. Wrap the TABLEUPDATE in a transaction so ROLLBACK can remove the blank record.
use View1 nodata
local laViewFields(1), laExpressions(1), ln, lcTableField, lcTableRule, lc
= ALINES(laViewFields,STRTRAN(CURSORGETPROP("UpdateNameList"),',',CHR(13)))
ln = 0
for each lcField in laViewFields
  lcTableField = substr(lcField,at(' ',lcField)+1)
  ln = ln + 1  
  dimension laExpressions(ln,2)
  laExpressions(ln,1) = lcTableField
  laExpressions(ln,2) = DBGETPROP(lcTableField,'FIELD''RuleExpression')
  lcTableRule = 'Check_Field(&lcTableField)'
  =DBSETPROP(lcTableField,'FIELD','RuleExpression',lcTableRule)
endfor
private paFieldList(1)
select View1
append blank
BEGIN TRANSACTION
= tableupdate(1,.t.)
ROLLBACK
for ln = 1 to alen(laExpressions,1)
  lcTableField = laExpressions(ln,1)
  lcTableRule = laExpressions(ln,2)
  =DBSETPROP(lcTableField,'FIELD','RuleExpression',lcTableRule)
endfor
for each lc in paFieldList
  ? lc
endfor
return


procedure Check_Field(tcField)
local ln
if empty(paFieldList)
  ln = 1
else
  ln = alen(paFieldList) + 1
endif
dimension paFieldList(ln)
paFieldList(ln) = tcField
return
Bill Morris
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform