# Using Define Files for ODBC (High Level method) (not included in filePro Lite)

Use the "Define Files" option to create links to existing ODBC files. You cannot create a new ODBC file using define files but can only establish links to the data source with the "High Level" method. If you want to create an ODBC file, use the Low-Level method.

Using the "Define Files" option is the simplest method and should be considered by both new filePro developers and filePro experts as the first method. Take a look at the restrictions for the High-Level method and topic "What Method Should I Use ?" before selecting a method.

When using "Define Files" (ddefine), there is now a third choice, "ODBC data source".

Upon selecting "ODBC data source", the standard Windows ODBC "select data source" dialog will appear:

The first step is to select the type of source being used. (For example, "MS Access Database", or "SQL Server".)

Once the source type is selected, a type-specific dialog will appear, allowing you to select the actual source of the data. For example, if using an MS Access Database, you will be asked for the name of the .mdb file, using the standard Windows "open file" dialog:

Other data source types may use other dialogs to select the data source.

The actual table within the data source must be selected. This is currently done with a Windows dialog that will either be redesigned, or pulled back into a filePro dialog.

Click the First/Prev/Next/Last buttons to scroll through the available tables. Click SELECT when the proper table is shown.

At this point, the data source has been selected, and you are returned to ddefine s ODBC information screen:

Note: Pressing F6 in the "Table" field will redisplay the table-select dialog, allowing you to select a different table from the list.

Note: Some combinations of Windows and video drivers cause parts of the screen to not be redrawn upon taking down the table-select dialog. This is being looked into. If necessary, press Alt+Enter twice to switch to full-screen text mode and back to the GUI desktop to force Windows to redraw the screen.

ODBC data sources have two parts, a "DSN" (short for "Data Source Name") and a table name. These are what you defined with the previous dialogs. filePro needs one more piece of information e.g. the name of the unique ID field. The best way to do this is to press F6 within the "Unique ID field" entry to bring up a list of fields within the selected table.

Note that the current version has extra information displayed beyond just the column name, mostly for debugging purposes:

For the curious, the items within parens are:

· SQL data type, as a number.

· Data type, as a string returned from the ODBC database.

· The "autonumber" flag, as returned from the ODBC database.

· The "writable" flag, as returned from the ODBC database.

If you do not yet have a unique ID field specified, filePro will select any available autonumber field by default. It is important that you have a "autonumber" field available in the datasource since filePro will need this field to act as the pseudo @rn field. If there is no "autonumber" and you cannot assign one in the datasource, you should use the Low-Level method for ODBC files.

Once the unique ID field has been selected, save the ODBC datasource dialog to get to the standard ddefine field listing. Notice that filePro has already filled in the column names, lengths, and types:

The field names are not editable, as they are determined by the ODBC data source. The length and type are editable, and are initially filled in by filePro based on the information as returned from the ODBC table. While you can change the length and type to anything you want, you need to keep in mind the original ODBC data type. (For example, don t tell filePro to use an "MDY/" type if the ODBC type is "currency".) This allows you to determine, for example, which filePro date format to use when handling an ODBC date field, or to overlay a user-defined edit on top of a CHAR-type field.