Compartir a través de


Local View Wizard

With the Local View wizard, you can create views, which are customized displays of some or all information, using native Visual FoxPro data. You might want to use a view if the amount of source data is large, but you only need to display a particular portion of that data. If you do not have a database open, you are prompted to open a database or create one.

To access the Local View wizard

  1. From the Tools menu, choose Wizards, and click Query.

  2. In the Wizard Selection dialog box, choose Local View Wizard.

Step 1 – Select Fields

In this step, you specify which tables or views from a Visual FoxPro database you want to use as source for your local view. Using a view, you can gather information from one or more tables into a single display of information. A local view, unlike a Browse window, can make it possible for you to create very effective, perhaps simple, display from large or complex data sources.

You can select fields from several tables or views. First, select fields from one table or view and move them to the Selected fields box; then select fields from another table or view and move those.

Step 2 – Relate Tables

This step displays only if you select fields from more than one table or view. You can specify which fields in each table or view contain like information and can govern the relationship between the tables or view, thereby determining the included records.

Select the desired fields from the two drop-down list boxes, and then choose Add. If you use multiple tables in your view, then you must relate the tables by indicating which fields contain matching data in each table.

Step 2a – Include Records

This step displays only if you select fields from more than one table or view. You can specify which records from the selected tables will be made available to the Local View wizard.

If you are using more than one table, you can specify a join condition. For more information, see How to: Add Tables to Views. For example, if you specify only matching rows in Step 2a, you can further refine that choice in Step 3 by specifying a particular value for a field.

  • Limit the records to only matching rows
    Returns only records from both tables that match the comparison condition set between the two fields in the join condition. This is called an inner join.

  • All rows from either table
    Returns all the rows from the selected table. This makes it possible for you to create a left or right outer join.

  • All rows from both tables
    Returns matching and non-matching records from both tables. This is called an outer join.

By default, only matching records are included.

Step 3 – Filter Records

This step appears immediately after Step 1 if you have chosen only one table or view as source for your local view. You can specify a filter condition, so only certain of the records you have chosen to make available are used in the local view.

To determine the filter condition

  1. Select a field from the Field drop-down list.

  2. Specify an operator, such as equals or contains, in the Operator drop-down box.

  3. Specify a value in the Value textbox.

    For example, if you wanted to filter on a specific city, such as Helena, you might choose city from the Field drop-down list, choose equals in the Operator drop-down list, and enter Helena in the Value textbox.

You can reduce the number of records by creating expressions that filter records from the selected tables or views. You can create two expressions and connect them with And, which returns only records meeting both specified criteria, or Or, which returns records meeting either criteria.

You can see the result by clicking the Preview button.

Step 4 – Sort Records

This step makes it possible for you to specify one or more fields by which to sort the records in your local view.

Choose up to three fields or an index tag that already exists in the database to determine the order in which your view results will be sorted. Select Ascending to sort the view in ascending order or Descending to sort the view in descending order.

Step 4a – Limit Records

This step appears only if you have specified one or more sort fields in Step 4. You can further limit the number of records in the view, based on either a percent of the records returned or an actual number of records.

To see a percentage of the available records, choose the Percent of records radio button, and then specify the percentage in the Portion value edit box. See all records by selecting Number of records and then selecting All records. As shown in the following procedures, you can choose a portion of records from the beginning or the end of the available records.

To see the first 10 items

  1. Choose the Number of records radio button.

  2. Enter 10 in the Portion value box.

To see the last 10 records

  • In Step 4, change the sort order to Descending.

Note

This changes the sort order to last record = first read.

  1. In Step 4a, select the Number of records radio button.

  2. Enter 10 in the Portion value box.

Step 5 - Finish

In this step, you can choose how to handle the newly defined local view.

  • Save local view
    Saves the newly defined local view and exits the wizard.

  • Save local view and browse
    Makes it possible for you to save the new local view and then open it in a Browse window, so you can review the displayed data.

  • Save local view and modify it in the View Designer
    Makes it possible for you to save the new local view and then modify it when it opens in the View designer.

See Also

Reference

Query Wizard

Remote View Wizard

Other Resources

Wizards (Visual FoxPro)