ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / Managing databases / HFSQL / HFSQL functions
  • Type of import
  • Array items
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
HImportJSON (Function)
In french: HImporteJSON
HFSQL ClassicHFSQL Client/ServerAvailable only with these kinds of connection
Imports a JSON file in an HFSQL Classic data file. This data file must have been defined in the data model editor, or declared with HDeclare, HDeclareExternal or HDescribeFile).
Example
// Import "C:\MyFiles\Customer.json" into the Customer data file. 
// The Customer data file will be overwritten if it already exists (hImpCreation constant)
// A progress bar will be displayed in PROGBAR_ProgBar1
HImportJSON(Customer, "C:\MyFiles\Customer.json", "", "", hImpCreation, PROGBAR_ProgBar1)
Syntax
<Result> = HImportJSON(<Data file> , <Path of the JSON file> [, <List of destination items> [, <List of JSON keys to import> [, <Options> [, <Progress Bar>]]]])
<Result>: Boolean
  • True if the operation was performed,
  • False if an error occurs. HError identifies the error.
<Data file>: Character string
Name of the HFSQL Classic data file into which the JSON data is to be imported. If the physical data file does not exist, it is automatically created.
<Path of the JSON file>: Character string
Full path to the JSON file to be imported.
<List of destination items>: Optional character string
Names of items in the data file into which the JSON data is to be imported. These names can be delimited by simple quotes and separated by commas or carriage returns (CR).
Items of type Composite key, Binary Memo and Binary are ignored.
Items not included in this list will be initialized with the default value defined in the analysis.
If this parameter is not specified or is an empty string (""), all items are imported (except compound keys, binary items and binary memos) in the order in which they were created in the physical file.
<List of JSON keys to import>: Optional character string
List of keys associated with the values from the JSON file to be imported.
If this parameter is not specified or is an empty string, the values of all keys in the JSON file are imported.
<Options>: Optional Integer constant (or combination of constants)
Type of import:
hImpBreakableThe import operation can be interrupted by pressing Esc.
If the import is interrupted, the imported records are kept in the data file.
hImpCreationIf the data file into which the data will be imported already exists, it is overwritten.
hImpNormal
(default value)
If the data file into which the data will be imported already exists, it is populated with the imported data, otherwise the data file is created.
<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 - Server code This parameter is not available.
Remarks

Type of import

If the list of JSON keys is specified, all "JSON values" whose key names are identical to the names of the items in the data file will be imported.
Example: The data file defined in the analysis contains the following items: ITEM1, ITEM2, etc. The JSON file should therefore have the following structure:
{"File":
{
"ITEM1":Data of ITEM1,
"ITEM2":Data of ITEM2,
...
}
}
JSON keys that do not exist in the analysis or are not specified in the list of items will be ignored during the import.
If the list of JSON keys is not specified, the values of the JSON keys are imported into the items of the HFSQL data file that have the same name as the JSON keys.

Array items

HImportJSON can also be used to import array items.
Business / UI classification: Business Logic
Component: wd300hf.dll
Minimum version required
  • Version 21
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/13/2025

Send a report | Local help