PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK

  • Exporting the query content
  • Exporting a single record
  • Array items
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
HExportJSON (Function)
In french: HExporteJSON
ODBCNative Connectors (Native Accesses)Not available with these kinds of connection
Exports the records found in a data file (HFSQL or OLE DB), view or query to a JSON file.
Note: From version 19, HFSQL is the new name of HyperFileSQL.
Example
// Export all customers
HExportJSON(CUSTOMER, "C:\TEMP\Customer.json", hExpCreation)
Syntax
<Result> = HExportJSON(<Data file> [, <JSON file> [, <Items to export>]] [, <Options> [, <Progress Bar>]])
<Result>: Boolean
  • True if the operation was performed,
  • False if a problem occurred. HError is used to identify the error.
<Data file>: Character string (with or without quotes)
Name of data file used. If this name is not specified, HExportJSON handles the last data file used by the last function for HFSQL management (starting with the letter H).
<JSON file>: Optional character string
Full path of JSON file to generate.
<Items to export>: Optional character string
List of names of items to export. The names are delimited by single quotes and they are separated by commas or CR characters. The names of composite key items, binary items and binary memo items are ignored.
If this parameter corresponds to an empty string (""), all the items of the data file (except for the composite keys, binary keys and binary memo keys) are exported.
<Options>: Optional constant
Specifies the creation mode of JSON file:
hExpCreationIf the JSON file already exists, it is overwritten. An error occurs if this option is not specified and if the JSON file exists.
hExpBreakableThe export can be interrupted by pressing the Esc key on the keyboard.
If the export is interrupted, the JSON file is valid and it only contains the records exported before the interruption.
hExpNormal
(default value)
Standard operating mode.
<Progress Bar>: Optional character string (with or without quotes)
Name of Progress Bar control or name of window used to show the progress of file creation.
Remarks

Exporting the query content

To export the query content, you must initialize the query (HExecuteQuery) before using HExportJSON.

Exporting a single record

To export a single record to a JSON string, use HRecordToJSON.

Array items

If one of the exported items is an array item, each element of the array item is exported in a new level:
{"File":
{
"Item1":Data of item 1,
"Item2":Data of item 2,
"ArrItem":
[Data element 1, Data element 2, ...]
...
}
}

Reminder: Composite key, binary memo or binary items are ignored.
Component : wd240hf.dll
Minimum version required
  • Version 21
This page is also available for…
Comments
Video HexportJson
tps://youtu.be/QGcHHYgD2vI

https://windevdesenvolvimento.blogspot.com/2019/03/dicas-2047-windev-webdev-ios-json-3.html

// BTN EXPORTAR JSON HExportJSON

HExportJSON(empresa, "C:\TEMP\empresa.json", "", hExpCreation,PROGBAR_BARRA_PROGRESSO)

ShellExecute("C:\TEMP\empresa.json")
amarildo
17 Mar. 2019