PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
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_55 (Function)
In French: HImporteTexte_55
HImportText_55 is equivalent to HImportText available in WINDEV 5.5.
This function is kept for backward compatibility (this function will still be supported in the forthcoming version).
In version 8, HImportText has evolved and it can now be used to manage a function result. To benefit from these new features, use the new syntax of HImportText.
The documentation available in WINDEV 5.5 is as follows. Caution: the names of variables have changed.
 
Purpose
Importing a text file into a Hyper File file.
Syntax
<ErrorCode> = HImportTexte_55(<LogicalNameHFFile> , <NameTextFile> [ , <ItemList> [ , <Separators> [ , <ImportMode> [ , <WindowHandler> ]]]])
  • <ErrorCode> is an integer indicating the result of the import (0 if successful)
  • <LogicalNameHFFile> is a character string corresponding to the logical name of the Hyper File file (destination of the import).
  • <NameTextFile> is a character string corresponding to the name of the text file to import, with its full path
  • <ItemList> is a character string specifying the list of items of the Hyper File file found in the text file
  • <Separators> is a character string used to define the different separators (column separator, row separator and string delimiter)
  • <ImportMode> is an integer used to define the characteristics of the import (see Details)
  • <WindowHandle> is a long integer that contains the handle of the window receiving the progress bar or NULL if there is no progress bar.
Details
HImportText_55 is used to import the content of a text file into a Hyper File file, previously described in the data model editor.
<ItemList> is used to specify the items of the <LogicalNameHFFile> file to import. This parameter has the following format:
"<NameItem1> , <NameItem2> , <NameItem3>, ..., <NameItemN>"

In the text file to import, each record corresponds to a "row" and each item corresponds to a "column".

The default separators are:
  • the comma for the columns
  • the double quote ( " ) for the strings
  • CR (Carriage Return) for the rows.
<Separator> is used to modify the default separators. This parameter has the following format:
<ColumnSeparator> + Char(127) + <StringDelimiter> + Char(127) + <RowSeparator>

Caution: the string delimiter is limited to one character.
Example: If the columns are separated by a tabulation (TAB) in the text file, <Separator> = TAB+ Char(127)+" " " "+ Char(127)+CR
The characteristics of the import are given by <ImportMode>. This parameter corresponds to a constant (or to a combination of constants:
hImpNormalAdd the imported records to the existing file (.FIC) (default value)
hImpCreationCreate the file where the records will be added (if the ".Fic" file already exists, it is overwritten)
hImpOEM2ANSIConvert the imported strings from OEM to ANSI
hImpTestDuplicatesCheck the duplicates during the import
hImpTestIntegrityCheck the integrity during the import
hImpNoDelimiterThe string delimiters are ignored
Notes:
  • hImpNoDelimiter is used to consider the column separator as string delimiter.
  • Importing a row without string delimiter:
    The row in the text file is as follows: Montgomery,John,34000,Montpellier
    The corresponding record in the Hyper File file will be:
    • Last name: Martin
    • First Name: John
    • ZCode: 34000
    • City Montpellier
  • Importing a row with string delimiter:
    The row in the text file is as follows: "Montgomery","John, Peter","34000","Montpellier"
    The corresponding record in the Hyper File file will be:
    • Last name: Martin
    • First Name: John, Peter
    • ZCode: 34000
    • City Montpellier
  • The different <error codes> returned by HImportText are as follows:
    • 0: Import successful
    • 1: error allocating the import structure
    • 2: error initializing HF
    • 3: unknown file
    • 4: text file not found
    • 5: invalid mode
    • 6: invalid list of items
    • 7: opening the HF file
    • 8: opening the text file
    • 9: end of file reached
    • 10: allocating the read buffer
    • 11: invalid string
    • 12: error while retrieving a column
    • 13: error while transferring a column to a HF item
    • 14: invalid row
Notes
  • The following types of Hyper File items are supported:
    • Characters,
    • Unsigned short integer on 1 byte
    • Signed and unsigned integer on 16 bits
    • Signed integer on 32 bits
    • Simple real on 32 bits
    • Real in TurboPascal format
    • Double real on 64 bits
    • Currency type (on 10 bytes)
    • String:
      • dynamic (up to 64k)
      • filled with spaces
      • preceded by its length
      • ended by 0
    • The array items are not supported
  • This function affects the Hyper File files only.
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment