- Type of import
- Array items
In french: <Source>.ImporteJSON
Available only with these kinds of connection
// 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>]]]])
- 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:
|hImpBreakable||The 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.
|hImpCreation||If the import data file exists, it is overwritten.|
|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.
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.
<Source>.ImportJSON can also be used to import array items.
This page is also available for…