Partager via


Data Selection with Application Builder

After you plan your application, you need to select the data sources you need in developing your application. You can use the Application Builder Data Tab, Application Builder to add databases and tables to your application and project.

Adding Data Using the Data Tab

If you already have existing data, you can use the Data tab to create a data environment for your application by adding free tables or tables from a database to the application. As soon as you specify a table, the Application Builder displays it in the grid and prepares to create both a form and a report for the table. At this point, you have selected only which data sources to include. They are not actually added to the framework until you select the Generate button. If you want to add only the data source and not have new forms or reports, uncheck the options next to the table entry. If you have a form or report check box marked when you click the Generate button, the appropriate wizard creates a new document for that datasource. You can select a visual style for these documents from the Style drop-down lists.

You can later edit these documents in the Form tab or Report tab of the Application Builder. If you have datasources listed in the Data tab grid and you click the OK button to exit the Application Builder, Visual FoxPro prompts you to add the tables, forms and reports to your project and application. Clicking the Generate button performs the same function.

The documents generated by the Application Builder contain all the fields for the selected datasource. If you want more control over the layout of your document, run the Form Wizard or Report Wizard directly from the Wizards menu and add the newly created document in the Form tab or Report tab. You can also add or edit forms or reports from the Application Builder.

When you use the Application Builder to add data, it is marked in the project as Excluded, meaning that it is not bound into the built application. This enables you to edit the added table. A table built into an application is read-only and cannot be edited. If you want to include a table in the project and thereby make it read-only (for example, a special lookup table where data will not change), right-click on the table in the Project Manager, and select the Include menu item.

Creating Data Using the Data Tab

You can also use the Database Wizard or the Database Wizard buttons on the Data tab to create new tables to add to the project and application. These wizards create new data structures for your application in the appropriate data folder and allow you to generate new documents in the same manner discussed previously.

The basic documents that the Application Builder creates contain all fields in the tables on which they are based. These documents are excellent for basic data input and reporting, but you might want to create documents for other unique purposes in your application. The Form Wizard and Report Wizard offer more flexibility and the foundation classes included with the Component Gallery offer added functionality to forms and reports.

Locating Data

If you use the Application Builder to add data and documents to your application, data-binding is handled automatically. The Application Builder does, however, offer a Default Data Directory option on the Advanced Tab, Application Builder if you are manually coding documents to bind to data and need the application framework to handle data path resolution. Use this setting to specify a folder that contains your datasources to provide appropriate path information for this data.

Importing Data

With many applications, you may already have data that you wish to use, but it's not necessarily in the proper format. It might be in plain text or spreadsheet format. In these cases, you can use the Import Wizard to migrate your data into FoxPro tables. You can then easily add these tables to your application.

Upsizing Data

Visual FoxPro includes an upsizing wizard that allows you to move your FoxPro data to a SQL Server database. If the demands of your application require use of one of these databases, you can easily migrate your existing data and still keep the application intact.

The SQL Server Upsizing Wizard allows you to Create remote views on tables. If you select this option, the tables in your database will be changed to remote views. Since the documents (forms or reports) in your application are bound solely to the datasource name, you can still run your application, but the data being used will be SQL Server data instead of FoxPro tables.

If you have existing SQL Server data that you want to use in your application, you can easily set up a Visual FoxPro database containing remote views pointing to these datasources. The application framework will handle these just like they were native FoxPro tables.

See Also

Managing Documents with Application Builder