Share via


Customizing Views

You can customize views by defining how a field in a view displays, by controlling field display and data entry, by using expressions in views, by setting views up to prompt for values, and by setting advanced options to fine tune how data is exchanged with a server.

Controlling Field Display and Data Entry

Because your view is part of a database, you can take advantage of some of the same properties that a database provides for fields in a table. For example, you can assign captions, enter comments, or set validation rules to control data entry.

To control field display and data entry

  1. Create or modify a view in the View Designer.
  2. In the Fields tab, select a field in the Selected fields list.
  3. Choose Properties.
  4. In the View Field Properties dialog box, enter validation, display, and field type settings.

Controlling the Update Method

To control how information in key fields is actually updated on the server, use the options in the Update Using option group. These options determine what SQL command is used in the update statement sent to the server or source tables when key fields in records are updated.

You can specify that records be deleted and then replaced with the new values entered in the view (SQL DELETE then INSERT), or that server records be changed via the SQL UPDATE function supported by the server.

Adding Expressions to Remote Views

As with queries, you can include functions and expressions as filters in views.

To add an expression to a view

  • In the Filter tab, select Expression from the Field Name box.

If you are basing a view on a remote data source, the functions shown in the Expression Builder reflect the functions supported by that server. Check your server documentation for a listing of the functions your server supports. Visual FoxPro does not attempt to parse the expressions you build; instead, it passes them on to the remote server.

Prompting for Parameters

You can set up views that prompt for the entry of a value to complete the query. For example, suppose you want to create a query to find customers located in a specific country. To do this, you need to define a filter on the country field and specify a parameter as the example in the filter. Parameter names can be any combination of alphabetic characters, numbers, and single quotes.

To set up a parameter for a view

  1. In the View Designer, add a new filter or select an existing filter in the Filter tab.
  2. In the Example box, type a question mark (?) and the name of the parameter.

When you use the view, a message box appears prompting for a value to include in the filter.

Setting Timeout Intervals

If you need to adjust how Visual FoxPro interacts with your server, you can set timing options.

To set timeout intervals

  1. In the Project Manager, select a connection and choose Modify.
  2. In the Timeout intervals area, set the options you need.
  3. From the File menu, choose Save.

See Also

Working with Views | Updating Data | Connection Designer | Manipulating Offline Data | Query and View Designers | Working with Tables | Creating Queries | View Field Properties Dialog Box | Project Manager Window | Combining Views