- 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
Note: If the HFSQL data file used does not physically exist, this data file is automatically created.
Note: From version 19, HFSQL is the new name of HyperFileSQL.
This function is now available for the Java applications.
// 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(<File Name> , <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.
<File Name>: Character string (with or without quotes)
Logical name of data file in HFSQL format into which the import will 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 character string (with or without quotes)
Name of the window where the progress bar will be displayed or name of the Progress Bar control used to display the progress.
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 delimiter>: "
- <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…