Importing Visual FoxPro Files

Quick Guide to Importing Visual FoxPro Files

This article explains how to import Visual FoxPro databases, tables and source code files for reuse in your Lianja Apps. The target audience is developers who have read through and understood the Getting Started with Lianja tutorial and have existing Visual FoxPro databases, tables or source code. 

Importing Databases

Visual FoxPro databases (.dbc files) can be quickly and easily imported into the Lianja format for use in your Apps.  To import a Visual FoxPro database, select the Data Workspace and make sure no database is open.  You then have two ways to import your database: drag and drop import or the Import VFP database command.

1. Drag and Drop Import

To use drag and drop import:

  • Open the .dbc file location in Windows Explorer
  • Click on the .dbc file and drag it into the Databases Explorer in the Sidebar

Drag and Drop DBC

Double-click the name of the imported database in the Database Explorer to open :

Open Database

Use the Close database option under Additional commands to close the database:

Close Database

2. Import VFP database command

To use the Import VFP database command:

  • Click Additional commands at the bottom of the Databases Explorer then Import VFP database....  The Select a Visual FoxPro Database dialog will pop up allowing you to search for and select your .dbc file.

Import DBC

As before, double-click on the database name - expenses here - to open it.

Open Database

Double-clicking on a table name in the Tables tab of the Objects Explorer will open the table in the Data Editor.  Each open table will appear in its own tab:

Data Editor

You can also access the data from the Console Workspace and see that Lianja has also built the indexes for the imported tables:

List Status

Import ODBC database

If you have the Visual FoxPro ODBC Driver, you can also import databases this way, although it is more commonly used to provide developers with a local copy of SQL databases such as Microsoft SQL Server or MySQL.  This time, you need to create a database and make sure it is open before starting the import:

Create Database

Then Click Additional commands followed by Import ODBC database...

Enter the name of your ODBC DSN or connection string in the dialog, specifying the username and password if required. To only import specific tables, click Tables and make your selection. To start the import, click Import:

DSN

The Console Workspace will be selected to show the progress of the import in the Output Window.  When you reselect the Data Workspace you will see your imported data.

After Import ODBC

Create Virtual Tables from ODBC

As well as, or instead of, importing the tables from your ODBC data source, you can have Virtual Tables automatically created for them.

Again, create a new database and make sure it is open. Then Click Additional commands followed by Create Virtual Tables from ODBC...

Enter the name of your ODBC DSN or connection string in the dialog, specifying the username and password if required. To only create Virtual Tables for specific tables, click Tables and make your selection. To start the Virtual Table creation, click Import:

Create Virtual Tables from ODBC

The Console Workspace will be selected to show the progress of the import in the Output Window.  When you reselect the Data Workspace you will see your imported data.

Importing Free Tables

Free Visual FoxPro tables can also be imported.  Select the Data Workspace and make sure you have a database open.  Again, there are two ways to do this: drag and drop or the Add command.

1. Drag and Drop Import

To use drag and drop import:

  • Open the .dbf file location in Windows Explorer
  • Click on the .dbf file and drag it into the Tables tab of the Objects Explorer in the Sidebar

Drag Free

2. Add Command

To use the Add command:

  • Click Additional commands at the bottom of the Tables tab in the Objects Explorer then Add....  The Select a table dialog will pop up allowing you to search for and select your .dbf file.

Add Free

Importing Visual FoxPro Project Files

Visual FoxPro project files (.pjx files) can be quickly and easily imported to produce source code versions of your project's *.scx (converted to *.scp), *.vcx (converted to *.vcp), *.prg and *.txt files for reuse within a Lianja App.

To import a Visual FoxPro project file, select the Apps Workspace and make sure you have a new App open.  You then have two ways to import your project: drag and drop import or the Import VFP project (.pjx)... command.

1. Drag and Drop Import

To use drag and drop import:

  • Open the .pjx file location in Windows Explorer
  • Click on the .pjx file and drag it into the Files Explorer in the Sidebar

Drag and Drop Project

2. Import VFP project command

To use the Import VFP project (.pjx)... command:

  • Click Additional commands at the bottom of the Files Explorer then Import VFP project (.pjx)....  The Select a Visual FoxPro Project dialog will pop up allowing you to search for and select your .pjx file.

Import Project

Files from the project will be added into the relevant file type sections of the Files Explorer and can be edited by double-clicking on the filename:

Imported Project

Individual *.scx, *.vcx, *.prg, *.txt and image files can also be dragged and dropped into the File Explorer of an open App and forms and class libraries can be imported using the Import VFP form (.scx)... and Import VFP library (.vcx)... commands. Files are converted to their source code equivalents where required.

3. Drag and Drop Individual Files

To use drag and drop import:

  • Open the file location in Windows Explorer
  • Click on the file and drag it into the Files Explorer in the Sidebar. In the case of forms, drag the .scx file; for class libraries, drag the .vcx file.

Drag and Drop Individual Files

4. Import VFP form and library files

To use the Import VFP form (.scx)... and Import VFP library (.vcx)... commands:

  • Click Additional commands at the bottom of the Files Explorer then the Import VFP form (.scx)... or Import VFP library (.vcx)... command.  The Select a Visual FoxPro Form/Library dialog will pop up allowing you to search for and select your file.

Import Individual Files

See Also

Lianja Developers Guide
Lianja Documentation Wiki

 


Like the Lianja Facebook page for a chance to win a free copy