ExportIntoTable

Exports data from an existing table into a new table.   If a Dataset has been provided, exports just the rows in the Dataset, otherwise exports the whole table.

KeyValueDescription
method"ExportIntoTable"Exports data from an existing table into a new table. 
project"CurrentProject"Name of current project
table"NewTableName"Name of table to create.
fields[][
"field1",
"field2"
"..."
]
Note: Only 1 of fields, all, exportTemplate is allowed.
If all = true, then no field list is required. Otherwise, fields to export must be listed. 
alltrue/falseNote: Only 1 of fields, all, exportTemplate is allowed.
If all = true then all fields in the table will be exported. 
exportTemplate"TemplateName"Note: Only 1 of fields, all, exportTemplate is allowed.
Name of ExportTemplate to use when exporting. ExportTemplates are added to the system using CreateExportTemplate.
The ExportTemplate contains the list of fields to export. Use exportTemplate in place of fields[] or all.
Note: ExportTemplates are not the same as system templates, or dashboard templates
dataSet{}
Optional.  If specified, indicates the subset of records to export.
Note: if dataSet{} contains a high percentage of all records in the table, using ExportIntoTableEx may be faster.
appendtrue/falseOptional.  Default = false.
If true, will append data to existing table.   If false, and table already exists, will raise an error.
incrementaltrue/falseOptional.  Default = false
TODO: What does this do?
ignoreIfNoRowstrue/falseOptional.  Default = false
If true, and the table listed as "table" contains no rows, no error will be raised and the method will be skipped.
Use this to handle scenarios where no rows may be present in a table.
skipIfMissingSourceTabletrue/falseOptional.  Default = false
If true, and the table listed as "table" does not exist, no error will be raised, and the method will be skipped.
Use this when developing scripts that need to handle tables that may or may not be present.
minDiscreteSize0Reserved.  leave as 0.
adjustSymmetrytrue/falseOptional.  Default = false.
If true, if TableName already exists (and append=true), if a field is in the export field list (either as part of fields[], exportTemplate, or all) but is not in the existing Table, the field will be appended, and null data inserted for rows that were already in the table.
This is a way of adding new fields as part of an append to an existing table.
Note: use adjustSymmetry=true with care, as this removes a natural verification that the data being appended to an existing table has the same format as the original, which is often a useful check during script development.    
ctodtrue/falseIf true, an attempt will be made to convert source continuous fields to discrete fields during the export.     This depends on TODO: DiscreteThreshold, datatype and the number of records being exported.
NOTE: Use only when required as this will greatly increase export times.
ignoreIfEmptytrue/falsev5.10.19 and later
optional.
Default = true.
If the resulting table would be empty, by default ExportIntoTable will do nothing and no table will be created.
If false, will create a table with no records and no fields.
See ExportIntoTable - v5.10.13
abandonOnEmptytrue/falsev5.10.19 and later
optional.
Default = false.
By default if the dataset is empty 9(i.e., contains no records), am empty table with fields will be created.
If true, an empty table with no fields will be created.
See ExportIntoTable - v5.10.13
template"template name"name of field template that contains field list to include in export.
(Note: right-click in JSON panel to see list of available templates)
optimizetrue/falseoptional.  Default = true.
If false, will use pre v11.xx method of exporting.
excludeMetadatatrue/falsev6.11.7 and later
Optional.  Default = false
If true, metadata from the source table will not be included in the export.
completeFieldstrue/falseOptional.  Default = false
Only applies when append=true.
If true, and the field list (specified either by template, all or fields[]) does not contain the same list of fields as the target table, missing fields will be filled in with null records.
Caution!
Unbalanced tables can cause unexpected results - always ensure that tables have been properly balanced before completing data engineering and beginning analysis.


Blank export Function

{
  "method": "ExportIntoTable",
  "project": "",
  "table": "",
  "fields": [],
  "all": false,
  "exportTemplate": "",
  "template": "",
  "dataSet": {},
  "append": false,
  "incremental": false,
  "ignoreIfNoRows": false,
  "abandonOnEmpty": false,
  "skipIfMissingSourceTable": false,
  "allowUnbalanced": false,
  "minDiscreteSize": 0,
  "adjustSymmetry": false,
  "ctod": false,
  "autoUseExtended": false
}


Exporting with a field list

{
  "method": "ExportIntoTable",
  "table": "upserted",
  "append": false,
  "fields": [
    "table1.custid",
    "table1.gender",
    "table1.age",
    "table1.seq"
  ],
  "dataSet": {
    "logic": "or",
    "name": "SubSet",
    "strict": true,
    "set": [
      {
        "logic": "or",
        "stype": "TABLE",
        "entity": "table1"
      },
      {
        "logic": "remove",
        "stype": "TABLE",
        "entity": "table2"
      }
    ]
  },
  "project": "Upsert"
}


Exporting with a field template

{
  "method": "ExportIntoTable",
  "table": "table_name",
  "append": false,
  "dataSet": {
    "logic": "or",
    "name": "SubSet",
    "strict": true,
    "set": [
      {
        "logic": "or",
        "stype": "TABLE",
        "entity": "03_HEADER_BIG"
      },
      {
        "logic": "or",
        "stype": "INTRINSIC",
        "intrinsic": {
          "function": "top",
          "params": [
            "10000"
          ]
        }
      }
    ]
  },
  "template": "03-continuous",
  "project": "DataCleanAndInspect"
}

Exporting all fields in a table:

{
  "method": "ExportIntoTable",
  "project": "Metadata_Test",
  "table": "ExportedTable",
  "all": true,
  "append": false,
  "dataSet": {
    "logic": "or",
    "name": "SubSet",
    "strict": true,
    "set": [
      {
        "logic": "or",
        "stype": "TABLE",
        "entity": "framingham"
      }
    ]
  }
}


Error Messages

Error MessageCause/Resolution

target table already exists

Exception of type 'System.Exception' was thrown.

Table Name already exists in the project, and append = false
export template not found
Specified export template does not match any template in the project
append will produce unbalanced table - see  'completeFields'
The field list in the dataset to append does not match the field list in the target table.  Either change field list, or configure method to insert nulls for missing data using completeFields.
[Fieldname] does not exist on targetA field in the export field list is missing from the target table.   Verify target table field list and/or export field list.