|
|
|
|
HImportText_55 (Function) In french: HImporteTexte_55
Warning
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> = HImportText_55(<HF LogicalFileName> , <TextFileName> [ , <TopicList> [ , <Separators> [ , <ImportMode> [ , <HandleWindow> ]]]])- <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: | | hImpNormal | Add the imported records to the existing file (.FIC) (default value) | hImpCreation | Create the file where the records will be added (if the ".Fic" file already exists, it is overwritten) | hImpOEM2ANSI | Convert the imported strings from OEM to ANSI | hImpTestDuplicates | Check for duplicates during import | hImpTestIntegrity | Check integrity during import | hImpNoDelimiter | The string delimiters are ignored | Remarks:- 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 completed
- 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.
|
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|