PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Overview
  • Using the Native xBase/FoxPro Connector
  • Importing the structure of data files
  • The import steps
  • Taking into account the changes of the xBase/FoxPro data files
  • The important points regarding the programming
  • New features for managing the xBase/FoxPro data files
  • Dynamic description of an xBase data file
  • Opening data files described dynamically
  • Opening indexes that were described dynamically
  • Links between the xBase or FoxPro data files
  • Using the Native xBase/FoxPro Connector with non-Latin character sets
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Native xBase/FoxPro Connector
Native Connectors (Native Accesses)Available only with this kind of connection
Overview
WINDEV and WEBDEV propose a Native xBase/FoxPro Connector module (also called Native xBase/FoxPro Access). This Native Connector allows you to handle xBase/FoxPro data files from a WLanguage program without using any external driver.
Required configuration: The following files are supplied with WINDEV and WEBDEV: wdxxxdb.dll. This file is required by the Native Connector on xBase/FoxPro files in order to operate with an HFSQL Classic analysis.
Remark: From version 19, HFSQL is the new name of HyperFileSQL.
Using the Native xBase/FoxPro Connector
To use the Native xBase/FoxPro Connector in your WINDEV or WEBDEV applications:
  1. Import (if necessary) the description of the xBase/FoxPro data files into the WINDEV or WEBDEV analysis.
  2. Program with the HFSQL functions of WLanguage.
The management of xBase/FoxPro data files is similar to the management of HFSQL data files except for the cases explained in this help page.
Importing the structure of data files

The import steps

  1. In the data model editor, start the import wizard ("Structure of files .. Import the descriptions of files/tables"). In the data model editor, start the import wizard: on the "Analysis" pane, in the "Creation" group, expand "Import" and select "Import the descriptions of files/tables".
  2. Select the type of database: FoxPro/xBase. A connection to the xBase/FoxPro database is automatically established and associated with the data files imported into the analysis. This connection will have to be used to handle the xBase/FoxPro data file by programming.
  3. Specify whether the data must be kept in the current format (option required to use the Native xBase/FoxPro Connector).
  4. Select the access mode to the data files (Native xBase Access for WINDEV) and specify the directory of the data files.
  5. Select the tables that will be imported into the WINDEV analysis. These tables can be handled by programming with the HFSQL functions of WINDEV. These tables will be displayed in blue in the data model editor.
    Remark: the FoxPro databases (.dbc extension) are not supported. Each data file (.dbf extension) must be individually imported into the analysis.
  6. Validate. The tables are imported into the analysis. In the description of the data files, you will find the xBase subtype of the imported data file (dBase3+, dBase4, FoxPro/FoxBase, Clipper5, Clipper87).
Remarks:
  • An item defined as Numeric in FoxPro can be imported as currency into WINDEV and WEBDEV (if the size of the item exceeds the size of a real for example).
  • The Logical items in xBase/FoxPro are imported as Text items. Indeed, for a boolean in xBase, you have the ability to specify True and False with the 'T' and 'F' strings.

Taking into account the changes of the xBase/FoxPro data files

To take into account the changes of the tables imported into the data model editor, select "Structure of files .. Synchronize the analysis with the external databases". To take into account the evolutions of the tables imported into the data model editor, on the "Analysis" pane, in the "Analysis" group, expand "Synchronization" and select "Update the analysis from the external databases".
A wizard starts, allowing you to:
  • analyze the differences for the imported tables,
  • analyze the differences for all the xBase/FoxPro tables.
The important points regarding the programming

New features for managing the xBase/FoxPro data files

The management of xBase/FoxPro data files is similar to the management of HFSQL data files except for the cases explained in this help page.
New features regarding the management of xBase data files since WINDEV 5.5:
  • Managing an automatic identifier.
  • Ability to use HIndex.
  • Management of expressions in HFilter.
  • Ability to use HChangeDir.
  • Using the native xBase access with non-Latin character sets.
Managing FoxPro data files:
  • Support of memos in VFP format.
  • All the index formats are supported (including the indexes in VFP format corresponding to the .CDX extension). The indexes are read and modified.
  • Managing an automatic identifier.
  • Management of expressions in HFilter.
  • Ability to use HChangeDir.
  • Limitation: no FoxPro file can be reindexed.
  • Limitation: no FoxPro file can be created.

Dynamic description of an xBase data file

An xBase data file can be described by programming with the following functions:
HDBCreationEnds the dynamic description of the data file structure. The data file that was just described is created on disk in the path specified in HDBDescribeFile. The data, memo and index files are created on disk.
HDBDescribeFileDynamically describes a data file in dBase 3 format (most common format). This function is used to specify the name, abbreviation and access path of the xBase data file.
HDBDescribeIndexDynamically describes the different index files that will be created. An index file must be described for each search key. The created index file will be in dBase 3 format.
HDBDescribeFieldDynamically describes each item of the structure of an xBase data file described by HDBDescribeFile.
Example:
// Describe an xBase data file with the following items:
// LASTNAME, string of 20 characters
// FIRSTNAME, string of 20 characters
// AGE, integer on 3 digits
// BALANCE, real on 10 digits and 2 decimals
// MARRIED, boolean
// DOB, date
// INFO, text memo
 
HDBDescribeFile("DBCUSTOMER", "CD", "C:\FILE\CUSTOMER.DBF")
HDBDescribeField("LASTNAME,C,20")
HDBDescribeField("FIRSTNAME,C,20")
HDBDescribeField("AGE,N,3,0")
HDBDescribeField("BALANCE,N,10,2")
HDBDescribeField("MARRIED,L")
HDBDescribeField("DOB,D")
HDBDescribeField("INFO,M")
HDBCreation()
Remark: the FoxPro data files cannot be described dynamically. Only the dBase 3 format is supported.

Opening data files described dynamically

An xBase data file is not opened automatically: this data file must be opened by HDBOpen before it is used for the first time, except if it was created by HDBCreation (that creates and opens the data file).

Opening indexes that were described dynamically

HDBOpen opens the data file but not the index files. Therefore, you must open all the necessary index files for using the data file with HDBIndex.
If the index files are not opened, they will not be updated after a deletion, a modification or an addition.

Links between the xBase or FoxPro data files

The links are not automatically managed by WINDEV and WEBDEV. They must be managed by programming. Therefore, to access a record in the linked data file, you must find the corresponding record according to the link key (HReadSeek).
Example: A window displays the orders of a customer, the "ORDERS" data file contains the product number, the "PRODUCT" data file contains the product caption and the product number. For example, the initialization process of the window is:
// Read the orders
HReadFirst(ORDERS, Ord_Date)
IF HOut() = False THEN
// Find the corresponding product
HReadSeek(PRODUCT, ProNum, ORDERS.ProNum)
FileToScreen()
END

Using the Native xBase/FoxPro Connector with non-Latin character sets

To use the Native xBase Connector with non-Latin character sets, a standard OEM/ANSI conversion must be performed by the Native Connector. To do so, the following string must be specified in the extended information:
OEMTOANSI=WINDOWS;
Example:
  1. In the initialization code of the project, add the code used to modify the character set:
    ChangeCharset(charsetChinese)
  2. Create an xBase connection:
    HDescribeConnection("CntxBase", "", "", fExeDir(), "", hNativeAccessXBase, ...
    hOReadWrite, "OEMTOANSI=WINDOWS;")
    HChangeConnection("*", "CntxBase")
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment