AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Administrar bases de datos / HFSQL / Funciones HFSQL
  • Importing a Text Memo item
  • Importing a Binary Memo item
  • Importing an indexed item
  • Importing a Time item
  • Previous versions
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Imports a Text file into an HFSQL Classic or Client/Server data file. This data file must have been defined in the data model editor, or declared with HDeclare, HDeclareExternal or HDescribeFile).
Note: If the HFSQL data file used does not physically exist, it will be automatically created.
Ejemplo
// Imports the name, address and logo (binary memo) of customers.
// Reinitialize the other items.
// A line in the txt file therefore 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"

// This file contains 2 lines:
// "PlayerImport1","19850618"
// "PlayerImport2","19900512"

// sPlayerName and dBirthDate are 2 fields in the Player data file of type String and Date

IF HImportText(Player, sPathTextFile, "sPlayerName,dDateOfBirth", ...
    "," + Charact(127) + """" + Charact(127) + CR + Charact(127) + ".") THEN
	...
ELSE
	...
END
Sintaxis
<Result> = HImportText(<Data file> , <Full path of text file> , <List of items> , <Separators> [, <Options> [, <Progress Bar>]])
<Result>: Boolean
  • True if the operation was performed,
  • False if an error occurs. HError returns more details about the problem.
<Data file>: Character string
Name of the HFSQL data file to import into.
<Full path of text file>: Character string
Full access path to text file to import.
<List of items>: Character string
List of item names in the text file. Names can be delimited by single quotes and are separated by commas or CR characters. "Composite key" item names are ignored.
If this parameter is not specified or is an empty string (""), all items are imported (except compound keys) in the order in which they were created in the physical file.
<Separators>: Character string
List of separators used for columns, strings, rows and decimal places.
The various separators are separated by the character character(127) (for compatibility with WINDEV 5.5)..
<Column separator> + Charact(127) + <String separator> + Charact(127) +
<Row separator> + Charact(127) +<Decimal separator>
  • <Column separator>: String ("," by default).
  • <String separator>: Character (" by default)
  • <Row separator>: String (CR by default, i.e., 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 data file to import into exists, it will be overwritten.
hImpIgnoreFirstLineThe first line of the imported file is ignored.
hImpIgnoreInvalidLineImport ignores lines with an invalid structure.
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 populated in the text file, the corresponding lines are still imported.
The missing items contain:
  • the default value of the items if the hDefaultVal constant is specified.
  • the value of the items in the current record before calling HImportText.
hImpBreakableImport can be interrupted by pressing the Esc key (parameter ignored 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 data file to import into already exists, it is populated with the imported data; otherwise, the data file is created.
Data integrity and duplicates are not checked.
Non-imported items take the value of the current record.
String delimiters are used.
Automatic identifiers are recalculated.
OLE DBConectores Nativos Data integrity and duplicates are always checked.
hImpOEM2ANSIImported strings are automatically converted from OEM to ANSI.
hImpNoDelimiterString separators, if any, are part of the item.
hImpTestDuplicatesChecks for duplicate values on unique keys during an import operation (enabled only on unique keys, not on the entire record).
OLE DBConectores Nativos Always checks for duplicate values.
hImpTestIntegrityChecks data integrity during an import operation.
OLE DBConectores Nativos Data integrity is always checked.
hDefaultValFor 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 calling HImportText, if the hDefaultVal constant is not specified.
<Progress Bar>: Optional control name or window name
  • Name of the window in which the progress bar will be displayed,
  • Name of the Progress Bar control.
WEBDEV - Código Servidor This parameter is not available.
Observaciones
WINDEVWEBDEV - Código ServidoriPhone/iPadIOS WidgetMac CatalystAjaxHFSQL ClassicHFSQL Client/ServerProcedimientos almacenadosHyper File 5.5

Importing a Text Memo item

  • If the hImpNoDelimiter constant is not specified:
    The text to import can contain <Row separator> or <Column separator>. The text to import must not contain any <String separator>.
  • If the hImpNoDelimiter constant is specified:
    The text to import must not contain any <Row separator> or <Column separator> otherwise they will be interpreted as such. The text to import can contain <String separator>.
WINDEVWEBDEV - Código ServidorAndroidWidget Android iPhone/iPadIOS WidgetMac CatalystJavaAjaxHFSQL ClassicHFSQL Client/ServerProcedimientos almacenadosHyper 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 to be added to the memo. This is a character string. If this string is empty, the two next columns must be left blank in the text file.
  • Column 2: Memo type. This is a string that can take the following values:
    • "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 formatted as a string of up to 65535 characters. If the number of characters is greater, the string is truncated.
Structure of the text file to import
Consider the following example:
  • items to be imported:
    • <LASTNAME>: Text item
    • <AGE>: Numeric item
    • <FIRSTNAME>: Text item
    • <COMMENT>: Text memo
    • <PHOTO>: Image binary memo
  • delimiters used:
    • <String separator>: "
    • <Column separator>: ,
    • <Row separator>: CR
In this example:
  • If the hImpNoDelimiter constant is not used, the text file will have the following structure: "LASTNAME", AGE, "FIRSTNAME", "COMMENT", "PHOTO memo file", "PHOTO file type", "PHOTO memo info"+CR
  • If the hImpNoDelimiter constant is used, the text file will have the following structure: LASTNAME, AGE, FIRSTNAME, COMMENT, PHOTO memo file, PHOTO memo type, PHOTO memo info+RC
Each content can be empty.
WINDEVWEBDEV - Código ServidorAndroidWidget Android iPhone/iPadIOS WidgetMac CatalystJavaAjaxHFSQL ClassicHFSQL Client/ServerProcedimientos almacenadosHyper File 5.5

Importing an indexed item

HImportText cannot be used to import indexed items.
WINDEVWEBDEV - Código ServidorAndroidWidget Android iPhone/iPadIOS WidgetMac CatalystJavaAjaxHFSQL ClassicHFSQL Client/ServerProcedimientos almacenadosHyper 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 available formats in the analysis are:
  • HH
  • HHMM
  • HHMMSS
  • HHMMSSCC
WINDEV

Previous versions

This function replaces HImportText_55, which is kept for compatibility with WINDEV 5.5.
Clasificación Lógica de negocio / UI: Lógica de negocio
Componente: wd300hf.dll
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 28/03/2025

Señalar un error o enviar una sugerencia | Ayuda local