Export
  • 4 Minutes to read
  • Dark
    Light
  • PDF

Export

  • Dark
    Light
  • PDF

Article summary

Exports data into a file.

KeyValue(s)Description
method"Export"Exports data into file
alltrue/falseOptional. Default = false.  If true, all fields in the table will be exported.
NOTE: cannot be used at the same time as fields[], template or exportTemplate
asynchUpload

audittrue/falseAdded in v 5.7.18
Optional.  Default = false. If true, creates an audit penetration file of exported data.
Only works with fields[] option - will be ignored if using "all"
Audit processing time
Be aware of the additional processing time required when adding an audit to an export, particularly on wide tables.
createImportScripttrue/falseOptional. Default = false.  
If true, a CreateTableFromFile method is added to file [exportFileName].json
dataset {}{}Required.  Determines the data to export.
The simplest form of a dataset will be for all records in a table:
 "dataSet": {
    "logic": "or",
    "name": "01_KJV_BOOK_SUMMARY",
    "strict": true,
    "set": [
      {
        "logic": "or",
        "stype": "TABLE",
        "entity": "01_KJV_BOOK_SUMMARY"
      }
    ]
  },

Note: It is not recommended to edit dataset JSON by hand - instead, drag a dataset from the Project Explorer or HotBar and drop on the Export method's JSON window.

delimiter
  • Tab
  • Comma
  • Semi-colon
  • Pipe
  • HSTART

Optional.  Default = Comma
The following delimiters are supported:
  • Tab
  • Comma
  • Semi-colon
  • Pipe
  • HSTART


eid"stringID"an optional id string assigned by the calling application and stored in the export log entry
exportAlternateFieldstrue/falseOptional. Default = false
If true, fields in the export list that have been decoded (and therefore have an underlying source field) will export the source data rather than the decoded data. For example, rather than exporting "California", the source value of "CA" will be exported.
NOTE: exportAlternateFields only takes effect if the project has been configured to export source fields using SetProjectProperties 
exportFileName
Required.  The name of the file to output. 
  • If the file already exists and overwrite = false, an error will be raised.
  • Export will still occur if extension is missing - note there is no verification that supplied file extension (e.g., .txt) matches specified delimiter.
  • If no path is supplied, file location will be the output folder.
  • If an invalid path is supplied, error message "cannot open file for writing" will be generated.
  • Depending on settings for audit and infoAudit, export summary files of the format [exportFileName]_DSTAMP.info.json will be generated.
exportHeaderstrue/falseDefault = false.   If true, first row of generated file will contain header data:
exportTemplate

fields[][
"table1.field1"
"table1.field2"
"..."
]
Optional. List of fields to export.
  • Field names must be fully qualified.
  • All fields must come from the same table.

infoAudittrue/falseDefault = false.  If true, an info audit file will be created.
overwritetrue/falseDefault = false.  If true, file will be overwritten if it exists.
quotedStringExporttrue/falseDefault = false.  If true strings will be will be in quotes.
start0Optional.  Default = 0
Determines the URN number of the first line to output.
template"Template_name"Optional.  Default = ""
Name of field template that contains the fields to export. Use instead of "all", "fields" and "exportTemplate".
  • The field template owner table must match the owner table of dataset.
  • Use JSON helper to select from existing templates.
upload

urnstrue/falseDefault = false.   If true, urn will be included.
NOTE: This only works with "fields" - it does not work with "all"
project

Output Files

The following output files may/will be created:

  • Data File - always created  [exportFileName]
  • Export Summary report - always created [exportFileName].info.json
  • Audit Spreadsheet - generated if audit=true  [exportFileName].xlsx
  • Info Audit report - extended version of export summary report, generated if infoAudit = true  [exportFileName].info.json 
  • Load Script - generated if createImportScript is true  [exportFileName].json 

Examples

Blank Method

{
  "method": "Export",
  "project": "",
  "exportAlternateFields": false,
  "urns": false,
  "exportHeaders": false,
  "quotedStringExport": false,
  "createImportScript": false,
  "exportFilename": "",
  "eid": "",
  "delimiter": "Tab",
  "fields": [],
  "all": false,
  "exportTemplate": "",
  "template": "",
  "audit": false,
  "dataSet": {},
  "overwrite": false,
  "start": 0,
  "upload": false,
  "asyncUpload": false,
  "infoAudit": false
}

Example method

{
  "method": "Export",
  "exportHeaders": false,
  "urns": false,
  "quotedStringHeaders": false,
  "overwrite": true,
  "eid": "60ada34aef4fbbe9c771946a",
  "tabDelimited": true,
  "createImportScript": false,
  "fields": [
    "%MODEL%%STABLE%TEMP.%XFIELD%",
    "%MODEL%%STABLE%TEMP.%YFIELD%"
  ],
  "dataSet": {
    "logic": "or",
    "name": "SubSet",
    "strict": true,
    "set": [
      {
        "logic": "or",
        "stype": "TABLE",
        "entity": "%MODEL%%STABLE%TEMP"
      }
    ]
  },
  "exportFilename": "%DATAPATH%%XFIELD%_%YFIELD%%DSTAMP%.txt",
  "project": "Demonstration"
}

Export Summary report

Exporting to file will automatically generate an export summary file: 


Example Audit Report

The Audit report is an excel file that summarizes the data that has been export in 2 forms:

  • Fields - summary data for each exported field
  • Penetration - value counts for each discrete field.

Control audit file output using the "audit" option


Fields

 

Penetration

See also:


Example Info Audit Report

The info audit report is a summary report with additional information concerning atomic fields

  • atomicDatasetFields - atomic fields used in generating the dataset.
  • atomicFieldDetail - atomic fields used in generating the output fields.

Control Info Audit using the infoAudit option.

{
  "records": 66,
  "length": 3563,
  "filename": "MyTestFile_infoaudit.txt",
  "atomicExportFields": [
    "01_KJV_BOOK_SUMMARY.BookTestament",
    "01_KJV_BOOK_SUMMARY.BookOrdinal",
    "01_KJV_BOOK_SUMMARY.BookTitle"
  ],
  "infoFilename": "d:/.../dj-localhost/output/MyTestFile_infoaudit.txt_20250107115315.info.json",
  "resolvedFilename": "d:/.../dj-localhost/output/MyTestFile_infoaudit.txt",
  "atomicDatasetFields": [],
  "user": "aaa@company.com",
  "realm": "dj-localhost",
  "dateCreated": "2025-01-07 11:53:15",
  "host": "NAME",
  "atomicFieldDetail": [
    {
      "field": "01_KJV_BOOK_SUMMARY.BookTestament",
      "notnull": 66
    },
    {
      "field": "01_KJV_BOOK_SUMMARY.BookOrdinal",
      "notnull": 66
    },
    {
      "field": "01_KJV_BOOK_SUMMARY.BookTitle",
      "notnull": 66
    }
  ],
  "request": {
    "method": "Export",
    "exportAlternateFields": false,
    "urns": false,
    "exportHeaders": false,
    "quotedStringExport": true,
    "createImportScript": true,
    "eid": "",
    "audit": true,
    "overwrite": false,
    "start": 0,
    "upload": false,
    "asyncUpload": false,
    "infoAudit": true,
    "all": true,
    "dataSet": {
      "logic": "or",
      "name": "01_KJV_BOOK_SUMMARY",
      "strict": true,
      "set": [
        {
          "logic": "or",
          "stype": "TABLE",
          "entity": "01_KJV_BOOK_SUMMARY"
        }
      ]
    },
    "project": "BibleProject2",
    "exportFilename": "d:/datajet/dj-localhost/output/MyTestFile_infoaudit.txt",
    "fields": [
      "01_KJV_BOOK_SUMMARY.BookTestament",
      "01_KJV_BOOK_SUMMARY.BookOrdinal",
      "01_KJV_BOOK_SUMMARY.BookTitle"
    ]
  }
}


Example load script

Generated if createImportScript is true:

Error messages

ErrorPossible Cause(s)
request must contain only one of 'fields', 'all', 'template' or 'exportTemplate'too many properties have been included in the call - keep one, and remove the others.
a file with that name already existsprovide a different value for exportFilename or set overwrite to true.
no fields selected for exportprovide one of the following: fields, all, template, exportTemplate

ambiguous field name   [] is not a field

make sure "fields" contains fully qualified field names, including the table.
export template not found"template" or "exportTemplate" points to an invalid field template.
cannot open file for writinginvalid path specified for exportFileName 





Was this article helpful?