Freigeben über


Creating Rules on View Fields and Rows

You can create local versions of remote data source rules to:

  • Reduce response time.
  • Reduce impact on network resources.
  • Test data before sending it to the remote data source.
  • Prevent sending faulty data to the remote data source.

Visual FoxPro doesn't compare the rules you create locally with remote rules. You must create rules that are acceptable for the data source. If remote rules change, you must change your local rules to match.

To create a rule on a view field or row

  • In the Fields tab in the View Designer, select a field, and then choose Properties and enter the rule expression and message text for the field.

    -or-

  • Use the RuleExpression and RuleText properties of the DBSETPROP( ) function.

For example, the following code creates a field-level rule on orditems_view that prevents entering a quantity of less than 1:

OPEN DATABASE testdata
USE VIEW orditems_view
DBSETPROP('Orditems_view.quantity','Field', ;
         'RuleExpression', 'quantity >= 1')
DBSETPROP('Orditems_view.quantity','Field', ;
         'RuleText', ;
'"Quantities must be greater than or equal to 1"')

You can also use the DBSETPROP( ) function to create row-level rules.

See Also

Creating Default Values for View Fields | Combining Views | Creating Queries | Manipulating Offline Data | Creating Offline Views | Displaying Data with Views | Creating Views