Help / WLanguage / Managing databases / HFSQL / HFSQL functions
  • Type of import
  • Array items
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
Imports a JSON file in a data file in HFSQL Classic format (data file described in the data model editor or declared by <Source>.Declare, <Source>.DeclareExternal or <Source>.DescribeFile).
// 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
Customer.ImportJSON("C:\MyFiles\Customer.json", "", "", hImpCreation, PROGBAR_ProgBar1)
<Result> = <Source>.ImportJSON(<Path of the JSON file> [, <List of items to import> [, <List of "items" to import> [, <Options> [, <Progress Bar>]]]])
<Result>: Boolean
  • True if the operation was performed,
  • False if an error occurred. HError is used to identify the problem.
<Source>: Type corresponding to the specified source
Name of HFSQL Classic data file into which the import will be performed. This file is automatically created if it does not physically exist.
<Path of the JSON file>: Character string
Full access path of the JSON file to import.
<List of items to import>: Optional character string
List of names of items in the data file into which the import will be performed. The names can be delimited by single quotes and are separated by commas or CR (Carriage Return) characters. The names of the composite key items, binary memo items and binary items are ignored.
The non-imported items will be initialized with their default value described in the analysis.
If this parameter is not specified or corresponds to 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 "items" to import>: Optional character string
List of names of items to import. If this parameter is not specified or if it corresponds to an empty string, all the items found in the JSON file are imported.
<Options>: Optional Integer constant (or combination of constants)
Type of import to perform:
hImpBreakableThe import can be interrupted by pressing the Esc key on the keyboard.
If the import is interrupted, the imported records are kept in the data file.
hImpCreationIf the import data file exists, it is overwritten.
(default value)
If the import data file already exists, it is filled 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.

Type of import

If the list of items is specified: the import will find the "JSON items" with the same name as the items.
Example: The data file described in the analysis contains the following items: ITEM1, ITEM2, ... The JSON file must have the following structure:
"Item1":Data of item 1,
"Item2":Data of item 2,
The names of items found in the JSON file that do not exist in the analysis or that are not specified in the list of items will be ignored during the import.
If the list of JSON items is not specified, the value of the JSON items is included in the item of the HFSQL data file that is named like the JSON item.

Array items

<Source>.ImportJSON can also be used to import array items.
Component: wd300hf.dll
Minimum version required
  • Version 25
This page is also available for…
Click [Add] to post a comment

Last update: 07/06/2023

Send a report | Local help