PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN

This content has been translated automatically. Click here to view the French version.
  • Type of import
  • Encoding
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
HJSONToRecord (Function)
In french: HJSONVersEnregistrement
HFSQLHFSQL Client/ServerAvailable only with these kinds of connection
Imports JSON data into the current record.
Example
let sChaîne1 = "{ ""Nom"":""Tintin"", ""Prenom"":[""Milou"", ""IDEFIX""] }"
let b1 = HJSONToRecord(Client, sChaîne1)
IF ErrorOccurred = True THEN
// Message complet de l'erreur principale
Trace(HErrorInfo())
// Parcours des sous-erreurs (s'il y en a)
FOR i = 1 _TO_ ErrorInfo(errNumberSubError)
// Message complet de chaque sous-erreur
Trace("Sous-erreur " + i + ": " + ErrorInfo(errMessage, i))
END
END
HAdd(Client)
Syntax
<Result> = HJSONToRecord(<Data file> , <JSON data> [, <List of items to import> [, <List of "items" to import>]])
<Result>: Boolean
  • True if no problems were encountered during import,
  • False otherwise. HErrorInfo returns more details about the problem.
<Data file>: Optional character string
Name of HFSQL data file used. JSON data is imported into the current record.
<JSON data>: Character string) or JSON variable
JSON data to be converted to record. This data can correspond to a JSON string or to a JSON variable.
<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 JSON item names to import. If this parameter is not specified or corresponds to an empty string (""), all JSON items are imported.
If an item remains is not found, a non-fatal error is returned.
Remarks

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:
{"Fichier":
{
"Rubrique1":Donnée de la rubrique 1,
"Rubrique2":Donnée de la rubrique 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.

Encoding

The encoding used corresponds to the JSON standard:
  • 7-bit ASCII encoding, i.e. the first 128 characters, unaccented characters,
  • JSON encoding for the other characters: "\u" followed by the character code in 4-byte hexadecimal.
Example: for "é" (ASCII code 233, hexadecimal code E9), the encoding corresponds to "\u00E9".
Business / UI classification: Business Logic
Component: wd270hf.dll
Minimum version required
  • Version 26
This page is also available for…
Comments
Click [Add] to post a comment