- Importing a Text Memo item
- Importing a Binary Memo item
- Importing a subscripted item
- Importing a Time item
In french: HImporteTexte
Not available with this kind of connection
Imports a Text file into a data file in HFSQL Classic or Client/Server format (data file described in the data model editor, or declared by HDeclare
Remark: If the HFSQL data file used does not physically exist, it will be automatically created.
// Imports the name, address and logo (binary memo) of customers.
// Reinitialize the other items.
// A line in the import file contains 3 or 5 columns:
// - Name, - Address, - File name for the logo
// (if the file name for the logo differs
// from empty string, 2 additional columns)
// - The type of the memo (IMG), - A comment
IF HImportText("CUSTOMER", "C:\AnExample\Customer.txt", ...
"NAME, ADDRESS, LOGO", hDefaultVal, "ProgressBar1") = False THEN
Error("Unable to import")
// This file will be imported
sPathTextFile is string = "ImportPlayer.txt"
// Content of this file (2 lines):
// sPlayerName and dDateOfBirth are 2 String and Date items found in the Player file
IF HImportText(Player, sPathTextFile, "sPlayerName,dDateOfBirth", ...
"," + Charact(127) + """" + Charact(127) + CR + Charact(127) + ".") THEN
<Result> = HImportText(<Data file> , <Full path of text file> , <List of items> , <Separators> [, <Options> [, <Progress Bar>]])
- True if the operation was performed,
- False if an error occurred. HError returns more details about the problem.
<Data file>: Character string (with or without quotes)
Name of the HFSQL data file into which the import must be performed.
<Full path of text file>: Character string (with quotes)
Full access path to text file to import.
<List of items>: Character string (with quotes)
List of item names in the text file. The names can be delimited by single quotes and they are separated by commas or CR characters. The names of composite key items are ignored.
If this parameter is not specified or if it corresponds to an empty string, all the items are imported (except the composite keys) in the physical order of description.
<Separators>: Character string (with quotes)
List of separators used for the columns, the strings, the rows and the decimal places.
The different separators are separated by Charact(127) (for backward compatibility with WINDEV 5.5).
<Column separator> + Char(127) + <String separator> + Char(127) +
<Row separator> + Char(127) +<Decimal separator>
- <Column separator>: Character string (", " by default).
- <String separator>: Character (" by default)
- <Row separator>: Character string (CR by default, which means Charact(13)+Charact(10))
- <Decimal separator>: Character ("." or "," by default)
<Options>: Optional Integer constant (or combination of constants)
Configures the type of import to perform:
<Progress Bar>: Optional control name or window name
- Name of window where the progress bar will be displayed,
- Name of Progress Bar control used to display the progress.
This parameter is not available.
Importing a Binary Memo item
For a binary memo item, 3 columns are associated in the text file.
- Column 1: full path of the binary file that must be added to the memo. This is a character string. If this string is empty, the two following columns must not be specified in the text file.
- Column 2: type of the memo. This is a character string that is set to:
- "IMG" to indicate that the file is an image file.
- "WAV" to indicate that the file is a sound file.
- "OLE" to indicate that the file is an OLE file.
- "BIN" (or other) to indicate that the file is an ordinary binary file.
- Column 3: information message. This is a character string (up to 65535 characters. If it is larger, the string is truncated).
Structure of text file to import:
The following items must be imported:
- <LASTNAME>: text item
- <AGE>: numeric item
- <FIRSTNAME>: text item
- <COMMENT>: text memo
- <PHOTO>: image binary memo
The following delimiters are used:
- <String separator>: "
- <Column separator>: ,
- <Row separator>: CR
If the hImpNoDelimiter constant is not specified: "LASTNAME", AGE, "FIRSTNAME", "COMMENT", "file of PHOTO memo", "type of PHOTO file", "info of PHOTO memo"+CR
If the hImpNoDelimiter constant is specified: LASTNAME, AGE, FIRSTNAME, COMMENT, file of PHOTO memo, type of PHOTO memo, info of PHOTO memo+CR
Each content can be empty.
This page is also available for…