By default, when a project is created, the Export To File function in Dataset Scratch will export the displayed data. However, it is possible to export the underlying data codes by selected the "Export Source Fields" option.
If using script, use the Export method.
Configuring a project to export source fields
To set up a project to export data codes, the project property "alternateFieldNameSuffix" must first be configured in the project properties using SetProjectProperties. The following example tells the server to look for {FieldName}_source when exporting, and if it exists, to export in place of {FieldName}
So if DataField1 is in the export field list and field DataField1_source exists in the table (Note that source fields are usually hidden), the column would be output with the header "DataField1" but with the contents of DataField1_source.
{
"method": "SetProjectProperties",
"project": "REGRESS_ExportSource_FULL",
"alternateFieldNameSuffix": "_source"
}
Verifying Export Configuration
To verify whether or not a project has been configured to export source fields, use the following in runner:
{
"method": "ReadMongo",
"query":{"class":"BatProjectMarker"}
}
Then check to see the "alternateFieldNameSuffix" property. This project has NOT been configured to export source data:
This project HAS been configured to export source data:
Sample Export
Source fields NOT configured
Source fields configured:
Injecting Data
When injecting data, be aware that the project properties of the package that is being injected will overwrite the existing project properties in the consumer project. This is so that metadata and campaign configuration associated with the package being injected (i.e., the properties present in the source project at the time the package was created) are automatically imported.
If a package without source field configuration is injected into a project with source field configuration, the configuration will be removed. To offset this, call SetProjectProperties again in the consumer project