Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursorgetprop('Fields')
Message
From
03/04/2002 12:57:17
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Cursorgetprop('Fields')
Miscellaneous
Thread ID:
00640440
Message ID:
00640440
Views:
53
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
Next
Reply
Map
View

Click here to load this message in the networking platform