PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • Importing a Text Memo item
  • Importing a Binary Memo item
  • Importing a subscripted item
  • Importing a Time item
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
HImportText (Function)
In French: HImporteTexte
ODBCNot 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, HDeclareExternal or HDescribeFile).
Note: If the HFSQL data file used does not physically exist, this data file is automatically created.
Versions 18 and later
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Universal Windows 10 App This function is now available in Windows Store apps mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Note: From version 19, HFSQL is the new name of HyperFileSQL.
Versions 22 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
Android Widget This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
WINDEVJava This function is now available for the Java applications.
New in version 22
iPhone/iPad This function is now available for the iPhone/iPad applications.
Android Widget This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
WINDEVJava This function is now available for the Java applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Android Widget This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
WINDEVJava This function is now available for the Java applications.
Example
// 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")
ELSE
// Process
END
// This file will be imported
sPathTextFile is string = "ImportPlayer.txt"

// Content of this file (2 lines):
// "PlayerImport1","19850618"
// "PlayerImport2","19900512"

// 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
...
ELSE
...
END
Syntax
<Result> = HImportText(<File Name> , <Full Path of Text File> , <List of Items> , <Separators> [, <Options> [, <Progress Bar>]])
<Result>: Boolean
  • 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:
hCopyAutoIdThe automatic identifier is copied. It is not recalculated.
hImpCreationIf the import data file exists, it is overwritten.
Versions 20 and later
hImpIgnoreFirstLine
New in version 20
hImpIgnoreFirstLine
hImpIgnoreFirstLine
The first line of the imported file is ignored.
hImpIgnoreInvalidLineThe lines whose structure are invalid are not imported: the import continues on the following lines.
The structure is invalid if data is missing for one or more items, or if string separators are missing.
hImpIgnoreEmptyItemIf one or more items are not filled in the text file, the corresponding lines are still imported.
The missing items contain:
  • the default value of items if the hDefaultVal constant is specified.
  • the value of items in the current record before the call to HImportText.
hImpBreakableThe import can be interrupted by pressing the ESC key (parameter not taken into account on data files in 5.5 format).
If the import is interrupted, the imported records are kept in the data file. A re-index operation is automatically performed if necessary (cannot be interrupted).
hImpNormal
(default value)
If the import data file already exists, it is filled with the imported data ; otherwise, the data file is created.
No management of integrity and no management of duplicates.
The non-imported items take the value of the current record.
The string delimiters are used.
The automatic identifiers are recalculated.
OLE DBNative Accesses The management of integrity and duplicates is always enabled.
hImpOEMToANSIThe imported strings are automatically converted from OEM to ANSI.
hImpNoDelimiterThe string separators (if they exist) are part of the item.
hImpTestDuplicatesEnables the management of duplicates on the unique keys during the import (the management of duplicates is enabled on the unique keys only and not on the entire record).
OLE DBNative Accesses The management of duplicates is always enabled.
hImpTestIntegrityChecks the integrity during the import.
OLE DBNative Accesses The management of integrity is always enabled.
hDefaultValFor the non-imported items, the values of the current record are reinitialized:
  • with their default value if the hDefaultVal constant is specified.
  • with the value of the corresponding items in the current record before the call to HImportText if the hDefaultVal constant is not specified.
<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.
WEBDEV - Server code This parameter is not available.
Remarks
WINDEVWEBDEV - Server codeUniversal Windows 10 AppAjaxHFSQLHFSQL Client/ServerStored proceduresHyper File 5.5

Importing a Text Memo item

  • The hImpNoDelimiter constant is not specified:
    The text to import may contain <Row Separators> or <Column Separators>. The text to import must not contain any <String Delimiters>.
  • The hImpNoDelimiter constant is specified:
    The text to import must not contain any <Row Separators> or <Column Separators> otherwise they will be taken into account as such. The text to import may contain <String Delimiters>.
WINDEVWEBDEV - Server codeAndroidAndroid Widget Universal Windows 10 AppJavaAjaxHFSQLHFSQL Client/ServerStored proceduresHyper File 5.5

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.
WINDEVWEBDEV - Server codeAndroidAndroid Widget Universal Windows 10 AppJavaAjaxHFSQLHFSQL Client/ServerStored proceduresHyper File 5.5

Importing a subscripted item

HImportText cannot be used to import subscripted items.
WINDEVWEBDEV - Server codeAndroidAndroid Widget Universal Windows 10 AppJavaAjaxHFSQLHFSQL Client/ServerStored proceduresHyper File 5.5

Importing a Time item

HImportText saves invalid times if the times to import are not in one of the formats available in the analysis.
Reminder: the following formats are available in the analysis:
  • HH
  • HHMM
  • HHMMSS
  • HHMMSSCC
Components
WINDEVWEBDEV - Server code wd230hf.dll
Java wd230java.jar
Linux wd230hf.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment