Creating the Import Bundle
To create the import bundle:
1. Craft an ASCII CSV text file for each Data Shape for which you are importing data. As you edit these files, ensure that they are opened and saved as text files. This is most easily accomplished using a text editor. If you use Microsoft Excel, do not open and save the file as an Excel document as this can result in corrupt data and make the file unusable for import.
For more information, see Formatting the CSV Files.
2. In a directory named Binaires, gather all binary files referenced by the CSV files. Use subfolders to separate multiple files with the same file name, as necessary. For more information, see Binary Content
3. Create a ZIP file containing the CSV files and Binaries directory at the top level. The following graphic shows an example import bundle structure:
Example structure of a import bundle
Formatting the CSV Files
Each CSV file is named for and represents a Data Shape in the Operator Advisor data model. For example, for the PTC.SCA.SCO.WorkDefinition Dats Shape, the CSV file is named PTC.SCA.SCO.WorkDefinition.csv.
The first row of each CSV lists the field names for the corresponding Data Shape. Each subsequent row represents an instance of that Data Shape, and on import is added as a row in the corresponding database table. The content for each entry in the row must be consistent with the data type for its Data Shape field. If a particular field value is empty, this is represented by no data between the commas.
The following is an example of a PTC.SCA.SCO.WorkDefinition.csv file:
UID,ID,Description,WorkType,Duration,SiteUID,DurationUnitOfMeasure,Name,LongDescription,ExecutionStatus,Version,SequenceNumber,ExecutionNotes
CREATE:1,1000001,PP Description,,,,,PP Name,PP Long Description,,A.1 (Design),0,
CREATE:2,1000002,OP10 Description,,,,,OP10 Name,OP10 Long Description,,A.2 (Design),10,
CREATE:3,1000003,OP20 Description,,,,,OP20 Name,OP20 Long Description,,A.3 (Design),20,
CREATE:4,1000004,OP1010 Description,,,,,OP1010 Name,OP1010 Long Description,,A.4 (Design),10,
CREATE:5,1000005,OP1020 Description,,,BUNDLE:1,,OP1020 Name,OP1020 Long Description,,A.5 (Design),20,
Certain fields must be specified in a certain way:
UIDs
The value for a UID must be specified in the format CREATE:<#>, for example CREATE:1. The prefix indicates the action to be performed for this row of the CSV file. In this case, CREATE: indicates that a row is to be created in the appropriate database table. The number must be unique within the CSV file. The actual UID value is autogenerated by ThingWorx when the new database row is added.
External References
External references are fields that reference the UID of a database row that is already present in Operator Advisor. For example, if the SiteUID field for a work definition in the CSV is referencing a site that already exists in Operator Advisor, specify the UID of that existing site.
Internal References
Internal references are fields that reference the UID of an entry in another CSV file in the bundle. These values must be specified as BUNDLE:<#>. The # must match the # from the UID field for that entry in its CSV file.
For example, if the SiteUID field for a work definition in the PTC.SCA.SCO.WorkDefinition.csv file is referencing an entry in the PTC.SCA.SCO.Site.csv file which has a UID value specified as CREATE:7, then the SiteUID value is specified as BUNDLE:7.
URLs
For URL fields, such as IllustrationURL on a work definition illustration or DocumentURL on a work definition related document, the value must be either a web URL, such as http://abc.com/file.html, or the path to a binary object in Binaries directory of the bundle. The value must not be empty. The path to a file in the Binaries directory includes a file:// prefix, and is relative to the base folder of the import bundle. For example, file://Binaries/Safety.doc or file://Binaries/subdir1/Safety.doc. Any binary objects referenced by a file path must be included in the import bundle.
Binary Content
Any binary content referenced from the CSV files must be included in the Binaries directory. If there are multiple binary files with the same name, use subfolders to separate them. For example, if there are multiple Safety.doc files, each with unique content, use a separate subfolder for each file. Each binary file can be referenced only once within the import bundle.
Binary files are any associated files with extensions such as PNG, DOC, PDF, and so on. These files are stored in a file repository rather in than the database, and are referenced by URL from entities such as work definition related documents (PTC.SCA.SCO.WorkDefinitionRelatedDocument). For the possible types of binary content, see the file types listed for the Type property of PTC.SCA.SCO.WorkDefinitionRelatedDocument.
Was this helpful?