DataQueryAndExport Operation to save results in JSON format (#11212)
Using the DataQueryAndExport operation, a console user can create a new operation using the Operation Center and specify a SQL SELECT query and a filepath to save the results to. The reults will be exported in the following JSON format:
|
Copy Code
|
{
"createdAt":"mm/dd/yyyy hh:mm:ss.fff",
"modifiedAt":"mm/dd/yyyy hh:mm:ss.fff",
"items": [{
...
}]
}
|
The difference in time recorded in createdAt and modifiedAt times represents the time processing took to query the database and transform the result into the JSON object. Each record returned in the results will represent one member of the items array and will contain field names that match the columns output in the results of the query.
The operation requires two attributes be supplied to function. These are query and filepath.
The query attribute contains the text for your SQL query. The following rules must be adhered to:
- The query must not include line breaks (e.g. all text on a single line).
- Any commas or colons in the query must be escaped using HTML replacements
- For a comma ",", use ,
- For a colon ":", use :
The filepath attribute contains the filename for the export file. The export file will autotically save to the /Exports folder in your CyberStore install directory. If one does not exist, it will be created when needed.
When the operaiton is run, if the file specified exists in the export folder, it will be backed up to a file whose name includes the last modified date stamp and then save the new version to the specified filename.
When no results are returned, no file is created, and an entry will be made in the Event Log.
If the query has an error, or is not a SELECT statement, the query will not be executed, and no file will be exported. An entry will be saved to the Event Log.
For security reasons some fields may not be able to be included in an export file.
Export options for XML and Excel for DataQueryAndExport Operation (#11213)
See Also