wc data load guide

84
Windchill ® Data Loading Reference and Best Practices Guide Windchill 9.1 December 2008

Upload: tatereman

Post on 18-Apr-2015

608 views

Category:

Documents


8 download

TRANSCRIPT

Page 1: Wc Data Load Guide

Windchill® Data Loading Referenceand Best Practices Guide

Windchill 9.1

December 2008

Page 2: Wc Data Load Guide

Copyright © 2007 Parametric Technology Corporation. All Rights Reserved.User and training guides and related documentation from Parametric Technology Corporation and its subsidiary companies (collectively “PTC”) is subject to the copyright laws of the United States and other countries and is provided under a license agreement that restricts copying, disclosure, and use of such documentation. PTC hereby grants to the licensed software user the right to make copies in printed form of this documentation if provided on software media, but only for internal/personal use and in accordance with the license agreement under which the applicable software is licensed. Any copy made shall include the PTC copyright notice and any other proprietary notice provided by PTC. Training materials may not be copied without the express written consent of PTC. This documentation may not be disclosed, transferred, modified, or reduced to any form, including electronic media, or transmitted or made publicly available by any means without the prior written consent of PTC and no authorization is granted to make copies for such purposes.

Information described herein is furnished for general information only, is subject to change without notice, and should not be construed as a warranty or commitment by PTC. PTC assumes no responsibility or liability for any errors or inaccuracies that may appear in this document.

The software described in this document is provided under written license agreement, contains valuable trade secrets and proprietary information, and is protected by the copyright laws of the United States and other countries. It may not be copied or distributed in any form or medium, disclosed to third parties, or used in any manner not provided for in the software licenses agreement except with written prior approval from PTC.

UNAUTHORIZED USE OF SOFTWARE OR ITS DOCUMENTATION CAN RESULT IN CIVIL DAMAGES AND CRIMINAL PROSECUTION.

For Important Copyright, Trademark, Patent, and Licensing Information: For Windchill products, select About Windchill at the bottom of the product page. For InterComm products, on the Help main page, click the link for Copyright 2007. For other products, select Help > About on the main menu for the product.

UNITED STATES GOVERNMENT RESTRICTED RIGHTS LEGENDThis document and the software described herein are Commercial Computer Documentation and Software, pursuant to FAR 12.212(a)-(b) (OCT’95) or DFARS 227.7202-1(a) and 227.7202-3(a) (JUN’95), and are provided to the US Government under a limited commercial license only. For procurements predating the above clauses, use, duplication, or disclosure by the Government is subject to the restrictions set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software Clause at DFARS 252.227 7013 (OCT’88) or Commercial Computer Software-Restricted Rights at FAR 52.227 19(c)(1)-(2) (JUN’87), as applicable. 02202007

Parametric Technology Corporation, 140 Kendrick Street, Needham, MA 02494 USA

Page 3: Wc Data Load Guide

Contents

Change Record.................................................................................................... vii

About This Guide.................................................................................................. xiRelated Documentation ................................................................................................................ xiTechnical Support......................................................................................................................... xiDocumentation for PTC Products................................................................................................ xiiComments ................................................................................................................................... xii

Introduction to Data Loading and the LoadFromFile Framework.................. 1-1Overview of Load Utilities ...........................................................................................................1-2

About the LoadFromFile Framework ................................................................................... 1-2About the Windchill Loader.................................................................................................. 1-4About the LoadFromFile and LoadFileSet Utilities .............................................................. 1-4

When to Use LoadFromFile and Import/Export ..........................................................................1-4Existing Load Methods ...............................................................................................................1-6

More About wt.doc.LoadDoc.beginCreateWTDocument ..................................................... 1-9More About wt.part.LoadPart.beginCreateWTPart .............................................................. 1-9More About wt.inf.team.ix.LoadSharedTeam .................................................................... 1-10More About wt.part.LoadPart.createPartRepresentation................................................... 1-11

Preparing Data for Loading ............................................................................... 2-1The Data Loading Process .........................................................................................................2-2Data Cleansing: About the Tools Available ................................................................................2-3

Text Editors: Pros and Cons................................................................................................ 2-3Microsoft Excel: Pros and Cons........................................................................................... 2-4Custom Code: Pros and Cons ............................................................................................. 2-5Windchill CounterPart: Pros and Cons ................................................................................ 2-6

Working with a Sample Data Set................................................................................................2-7Creating Data Extraction and Format Requirements..................................................................2-8

Developing Load Metrics ..................................................................................................... 2-8

Using the CSV2XML Utility and Validating the XML Format .......................... 3-1About the CSV2XML Utility.........................................................................................................3-2Converting CSV Files for Multibyte Operating Systems .............................................................3-2Converting CSV Files to XML Format Files................................................................................3-2

iii

Page 4: Wc Data Load Guide

Working with Larger Files .......................................................................................................... 3-3CSV2XML Arguments................................................................................................................ 3-3Validating the XML Format ........................................................................................................ 3-5

Selecting the Appropriate DTD at Runtime ......................................................................... 3-5About UpdateEditDTDUtility ................................................................................................ 3-6Using XML Spy to Validate the Data Files .......................................................................... 3-7

Loading Legacy Data Using the LoadFromFile and LoadFileSet Utilities.....4-1About Data Loading Utilities....................................................................................................... 4-2Using the LoadFromFile Utility ................................................................................................... 4-2

Sample Command Lines ..................................................................................................... 4-4More About CONT_PATH................................................................................................... 4-4

Using the LoadFileSet Utility...................................................................................................... 4-5About the Load Files .................................................................................................................. 4-6

Load File Set ....................................................................................................................... 4-6Sample Load File Set .......................................................................................................... 4-7Object XML Files ................................................................................................................. 4-7

Loading Legacy Data ................................................................................................................. 4-8Working with Containers ............................................................................................................ 4-9

Containers in Windchill PDMLink ........................................................................................ 4-9

Creating Load Methods......................................................................................5-1Customizing Loading ................................................................................................................. 5-2

About the csvmapfile.txt File ............................................................................................... 5-2Modifying Data Files .................................................................................................................. 5-3

Method 1: Modifying XML Load Files Directly ..................................................................... 5-3Method 2: Modifying CSV Files and Propagating Changes to XML and DTD Files............ 5-4

Creating New Methods for Loading ........................................................................................... 5-4About Load Methods ........................................................................................................... 5-4Creating a Document Class ................................................................................................ 5-7Creating a Part Class .......................................................................................................... 5-7

Loading Product Objects and Parts: Windchill PDMLink Example ...............6-1Before You Begin....................................................................................................................... 6-2

Specifying Types ................................................................................................................. 6-2Running the LoadFromFile Utility ........................................................................................ 6-2Loading Windchill PDMLink Products ................................................................................. 6-3

Loading Users............................................................................................................................ 6-4Creating Organizations .............................................................................................................. 6-4

Loading Organization Containers........................................................................................ 6-4Tag Descriptions ................................................................................................................. 6-5

iv Windchill Data Loading Reference and Best Practices Guide

Page 5: Wc Data Load Guide

Creating Product Containers ......................................................................................................6-5Creating Assemblies............................................................................................................ 6-8

Creating Library Containers......................................................................................................6-10Loading Documents in a Library ........................................................................................ 6-11Loading Documents that Are Soft Types of an Out-of-the-box Type................................. 6-12

Loading Product Objects and Parts..........................................................................................6-14Preparing the Files............................................................................................................. 6-14Loading the Files ............................................................................................................... 6-14Loading Parts with Specific Life Cycle and Team Templates............................................ 6-18Tag Description.................................................................................................................. 6-20

Loading Relationships Between Parts and Documents............................................................6-20Tag Descriptions................................................................................................................ 6-21

Loading Documents: Pro/INTRALINK 9.0 Example......................................... 7-1Loading Documents in a Pro/INTRALINK 9.0 System ...............................................................7-2Sample Data File for Pro/INTRALINK ........................................................................................7-2

Contents v

Page 6: Wc Data Load Guide

vi Windchill Data Loading Reference and Best Practices Guide

Page 7: Wc Data Load Guide

Change Record

Table 1 Changes for 9.0

Chapter Description

Global changes in guide to update references.

Updated the following:

• standardX05.dtd to standardX10.dtd

• standardX05 directory to standardX10 directory

• Deleted WTProduct and WTSerialNumberedPart

Introduction to Data Loading and the LoadFromFile Framework

• Updated the Overview of Load Utilities section by replacing three parameters for LoadFromFile with the following two parameters:

– Password

– CONT_PATH

• In the Existing Load Methods section, added wt.inf.team.ix.LoadSharedTeam and wt.part.LoadPart.createPartRepresentation.

Using the CSV2XML Utility and Validating the XML Format

Added the About UpdateEditDTDUtility section.

vii

Page 8: Wc Data Load Guide

Table 2 Changes for 8.0 (from 7.0 M020)

Loading Legacy Data Using the LoadFromFile and LoadFileSet Utilities

• Updated information on containers for Windchill 9.0 in the Working with Containers section.

• Added the optional username attribute to the load file set.

Loading Product Objects and Parts: Windchill PDMLink Example

• Added definition, sample, and tag description for <csvOrgContainer>.

• Added the <csvPart> tag description to the Loading Product Objects and Parts section.

• Replaced occurrences of wt.part.LoadPart.createProduct with wt.part.LoadPart.createProductContainer. This included the syntax of the XML file.

• Replaced samples.

Loading Documents: Pro/INTRALINK 9.0 Example

Updated to Pro/INTRALINK 9.0.

Chapter Description

Change Description

Changed references from standard70.dtd to standardX05.dtd

Global change in guide to update references to the new DTD file.

Loading Documents: Pro/INTRALINK 8.0 Example

Added chapter containing example for loading documents to Pro/INTRALINK 8.0 system.

Creating a Document Class Support for out of sequence iterations and versions. wt.doc.LoadDoc can handle loading out of sequence iterations and versions. Refer to the JavaDoc for information on the beginCreateWTDocument class.

viii Windchill Data Loading Reference and Best Practices Guide

Page 9: Wc Data Load Guide

Creating a Part Class Support for out of sequence iterations and versions. wt.part.LoadPart can handle loading out of sequence iterations and versions. Refer to the JavaDoc for information on the beginCreateWTPart class.

Change Description

Change Record ix

Page 10: Wc Data Load Guide

x Windchill Data Loading Reference and Best Practices Guide

Page 11: Wc Data Load Guide

About This Guide

The Windchill Data Loading Reference and Best Practices Guide provides a detailed description of the LoadFromFile framework and the LoadFromFile, LoadFileSet, and CSV2XML utilities. It also provides best practices for preparing and loading legacy data, with specific examples for a Windchill PDMLink and Pro/INTRALINK 9.0 system.

Examples in this guide referencing third-party products are intended for demonstration purposes only. For additional information about third-party products, contact individual product vendors.

Some code examples in this guide have been reformatted for presentation purposes and, therefore, may contain hidden editing characters (such as tabs and end-of-line characters) and extraneous spaces. If you cut and paste code from this manual, check for these characters and remove them before attempting to use the example in your application.

Related DocumentationThe following documentation may be helpful:

• Windchill Installation and Configuration Guide -- Advanced

• Windchill Customizer’s Guide

• Getting Started with Pro/INTRALINK 9.0

If these books are not installed on your system, see your system administrator.

Technical SupportContact PTC Technical Support via the PTC Web site, phone, fax, or e-mail if you encounter problems using <product name> or the product documentation.

For complete details, refer to Contacting Technical Support in the PTC Customer Service Guide. This guide can be found under the Related Links section of the PTC Web site at:

http://www.ptc.com/support/index.htm

xi

Page 12: Wc Data Load Guide

The PTC Web site also provides a search facility for technical documentation of particular interest. To access this page, use the following URL:

http://www.ptc.com/support/support.htm

You must have a Service Contract Number (SCN) before you can receive technical support. If you do not have an SCN, contact PTC Maintenance Department using the instructions found in your PTC Customer Service Guide under Contacting Your Maintenance Support Representative.

Documentation for PTC ProductsYou can access PTC documentation using the following resources:

• Windchill Help Page — Click Help in the header of any Windchill page to open the Windchill Help page, which provides you with a portal to all Windchill documentation, including:

– A complete set of current online help topics for your products

– Product tutorials available on the PTC Web site

– Windchill manuals for users, administrators, and programmers

In addition, you can click Search All Help Sources to access the Windchill Help Center, an online knowledgebase that includes a universal index of all Windchill documentation. You can search all of the documentation at once, or use the advanced search capability to customize your search. Once you have located a topic you want to reference later, you can bookmark that topic for quick access and even save your own comments about the topic.

• Product CD — All relevant PTC documentation is included on the CD set.

• Reference Documents Web Site — All books are available from the Reference Documents link of the PTC Web site at the following URL:

http://www.ptc.com/appserver/cs/doc/refdoc.jsp

A Service Contract Number (SCN) is required to access the PTC documentation from the Reference Documents Web site. For more information on SCNs, see Technical Support:

http://www.ptc.com/support/support.htm

CommentsPTC welcomes your suggestions and comments on its documentation. You can submit your feedback through the online survey form at the following URL:

http://www.ptc.com/go/wc_pubs_feedback

xii Windchill Data Loading Reference and Best Practices Guide

Page 13: Wc Data Load Guide

1Introduction to Data Loading

and the LoadFromFileFramework

This chapter provides an overview of the Windchill data loading utilities.

Section Page

Overview of Load Utilities..................................................................................1-2When to Use LoadFromFile and Import/Export .................................................1-4Existing Load Methods .......................................................................................1-6

1-1

Page 14: Wc Data Load Guide

Overview of Load UtilitiesMigrating legacy data into a new Windchill implementation is a fundamental requirement of any system implementation, yet historically it has been a laborious manual task. The same can be said about merging information from a new acquisition into a PDM environment, including Windchill.

PTC offers the LoadfromFile framework to help with these activities.

The wt.load package is a set of framework utilities for loading demonstration or test data. It can be expanded to load new classes. The LoadFromFile utility is callable from both the command line and from other classes.

Loading Data in Pro/INTRALINK 9.0Pro/INTRALINK is a data management solution designed to efficiently facilitate Pro/ENGINEER workgroup collaboration. Pro/INTRALINK 9.0 is the latest version of Pro/INTRALINK, now based on the PTC Windchill platform.

In Pro/INTRALINK 9.0, you use PDM capabilities to manage CAD documents and documents. Pro/INTRALINK supports loading of documents, but does not support loading of CAD documents via the LoadFromFile framework.

For a detailed example of loading documents in Pro/INTRALINK, refer to Loading Documents: Pro/INTRALINK 9.0 Example.

About the LoadFromFile Framework

The Windchill LoadFromFile framework performs the work of reading data from files and converting it to name-value pairs (represented as Hashtable), which are processed by the object loaders. In addition, the load framework provides some helper methods, which can be used by the loaders. Object loaders perform the actual work of creating the object, setting attributes on it, and persisting it to the database.

The framework uses some classes from the Import/Export framework. However, in most cases, the 'worker' classes (that is, object loaders for load and object handlers for Import/Export) are separate and expect data in different XML format. In other words, the XML schema is different.

LoadFromFile is a framework that can be used to load data into your own site classes. The wt.doc.LoadDoc.java source file is included as an example of how to use the load package.

1-2 Windchill Data Loading Reference and Best Practices Guide

Page 15: Wc Data Load Guide

LoadFromFile in the main or command line call, or the doFileLoad method call, use the following parameters to load data into the system:

• Data File

(Required) Contains data to be loaded and resides on the method server host. The data file is a required parameter. If the string is null or not on the command line, the load fails. It is recommended that you include the full path name of the file. If the full path is not provided, however, the method attempts to read the file in the directory in which the load was started.

• User

(Optional) Specifies the user to execute the method if no user is given in the line from the data file.

The command line does not use the -u user option so no user is preset. The main in LoadFromFile calls SessionHelper.manager.getPrincipal() to prompt for a user and perform the authentication. The doFileLoad still has the user passed in but it can be null. Demo and Developer authenticate before they call doFileLoad. It is recommended that you authenticate a user before calling doFileLoad, because it does not authenticate the user. The user would eventually be authenticated when the server side attempts to setPrincipal using the user passed in from doFileLoad, but the error messaging is best handled on the client side before calling doFileLoad.

• User Password

(Optional) Specifies the password for the authenticating user.

• CONT_PATH

Specifies the target container for the data.

The default target container is "Exchange".

To run LoadFromFile from the command line, be sure that the server manager and method server are running and then call:

windchill wt.load.LoadFromFile -d c:\ptc\Windchill\loadfiles\ReqDocs.xml

-CONT_PATH \

"/wt.inf.container.OrgContainer=TST/wt.pdmlink.PDMLinkProduct=part 4\"

Introduction to Data Loading and the LoadFromFile Framework 1-3

Page 16: Wc Data Load Guide

About the Windchill Loader

The Windchill Loader can load data for any of the installed Windchill solutions. The utility obtains a list of the installed solutions from the installed.properties file; which is updated when a solution is installed, and the loadsets for the base and demonstration data from the LoaderConfiguration.properties file. The loadsets are XML files that list the data files that must be loaded to support a Windchill solution.

Each solution has its own set of base and demonstration data. There is also a base data set (foundation) that applies to all of the solutions. The foundation base data is automatically installed along with the solution-specific base data.

In addition to initializing the database, the load utility will also add users and groups to the LDAP directory services as specified in the wt.federation.ie.ldapServer property setting in the wt.properties file.

For more information on the Windchill Loader and for instructions on initializing and populating the Windchill database with test data, refer to the Windchill Installation and Configuration Guide - Advanced.

About the LoadFromFile and LoadFileSet Utilities

In addition to the demonstration data that PTC provides, you may also have legacy data that you would like added to the Windchill database. PTC provides two utilities to load legacy data, LoadFromFile and LoadFileSet.

The load utilities only process XML files.The CSV2XML utility is used to convert CSV files to XML formatted files. The LoadFromFile utility loads a single, legacy data file into the database, whereas, the LoadFileSet utility loads multiple data files.

Refer to Loading Legacy Data Using the LoadFromFile and LoadFileSet Utilities later in this guide for information on using these utilities.

When to Use LoadFromFile and Import/ExportLoadFromFile, LoadFileSet, and the Import/Export framework are tools for moving data. Simply put, LoadFromFile is used for loading a single file into a Windchill system during the initial set up of the system. LoadFileSet is used for loading multiple files into a Windchill system during the initial set up of the system. Finally, the Import/Export framework is for data exchange between two existing systems.

1-4 Windchill Data Loading Reference and Best Practices Guide

Page 17: Wc Data Load Guide

LoadFromFile/LoadFileSet and Import/Export support different object types. Refer to the table below to see which tool supports a given object type.

Object LoaderSupported by Import/Export?

Data Formats LoadDataFormat No

Documents LoadDoc Yes

Effectivity LoadEffectivity No

Folders LoadFolder Yes

Values LoadValue Yes

Index Rules LoadIndexRule No

Containers (also known as Contexts)

LoadContainer No

Container Teams (also known as Context Teams)

LoadContainerTeam Yes (for shared teams only)

Container Templates (also known as Context Templates)

LoadContainerTemplate No

Life Cycles LoadLifeCycle Yes (separate user interface)

Content LoadContent Yes

Parts LoadPart Yes

Preferences LoadPreference No

Report Templates LoadReportTemplate No

Teams LoadTeam No

Views LoadView No

Workflows LoadWorkflow Yes

Notebooks LoadNotebook No

Users LoadUser No

CAD Documents N/A Yes

Introduction to Data Loading and the LoadFromFile Framework 1-5

Page 18: Wc Data Load Guide

Existing Load MethodsThe best way to see what methods are available to load with on your system is to look at the loadFiles.csvmapfile.txt file. The following is a brief directory of the methods available for loading data in the system. Full method paths are given to allow you to look them up in the JavaDoc.

• wt.doc.LoadDoc.createGeneral

Note: Legacy method to support existing systems.

Loads General documents; adds one content file and caches the General created for additional content additions.

• wt.doc.LoadDoc.createReq

Note: Legacy method to support existing systems.

Loads Requirements documents; adds one content file and caches the Requirements created for additional content additions.

• wt.doc.LoadDoc.createSpec

Note: Legacy method to support existing systems.

Loads Specification documents; adds one content file and caches the Specification created for additional content additions.

• wt.doc.LoadDoc.beginCreateWTDocument

Loads WTDocuments, soft types, and soft attributes. Supports versioning to allow a document to be created at a specified version and iteration. See More About wt.doc.LoadDoc.beginCreateWTDocument for more information.

• wt.load.LoadContent.createContentURL

Adds a content URL to a cached content holder.

• wt.load.LoadContent.createContentFile

Adds a content file to a cached content holder.

• wt.load.LoadContent.setDefaultDirectory

Sets a default directory where content can be found. It is in effect until the next setDefaultDirectory or the end of the data file.

• wt.load.LoadContent.setDefaultURL

Sets a default portion of the URL where content can be found. It is in effect until the next setDefaultURL or the end of the data file.

• wt.folder.LoadFolder.createCabinet

1-6 Windchill Data Loading Reference and Best Practices Guide

Page 19: Wc Data Load Guide

Creates a cabinet. It is used mainly for initializing the system. User cabinets are created automatically when a user is created.

• wt.folder.LoadFolder.createSubFolder

Creates a subfolder.

• wt.folder.LoadFolder.createFolderShortcut

Creates a folder shortcut.

• wt.load.LoadUser.createUser

Creates a new user.

• wt.load.LoadUser.createGroup

Creates a new group.

• wt.load.LoadUser.createUserGroup

Adds a user to a group.

• wt.load.LoadUser.createDomain

Creates a new domain.

• wt.load.LoadUser.createAccessRule

Adds an access rule.

• wt.part.LoadPart.createPart

Creates a part.

• wt.part.LoadPart.createPartRepresentation

Loads a representation and associates it to a given part. Assumes the part has already been created in the same load file. See More About wt.part.LoadPart.createPartRepresentation for more information.

• wt.part.LoadPart.addPartToAssembly

Adds a part to an assembly in a "uses" relationship.

• wt.part.LoadPart.createPartDocReference

Creates a "references" relationship between a part and an existing document.

• wt.part.LoadPart.beginCreateWTPart

Loads WTParts, soft types and soft attributes. Supports versioning to allows a part to be created at a specified version and iteration. See More About wt.part.LoadPart.beginCreateWTPart for more information.

• wt.index.LoadIndexRule.createIndexRule

Creates index rules for searches.

Introduction to Data Loading and the LoadFromFile Framework 1-7

Page 20: Wc Data Load Guide

• wt.lifecycle.LoadLifeCycle.createLifeCycleTemplate

Creates a life cycle template.

• wt.project.LoadProject.createIndirectRoleHolder

Creates a role-to-role mapping.

• wt.project.LoadProject.createRoleHolder

Creates a role-to-principal mapping.

• wt.project.LoadProject.createActorRoleHolder

Creates a role-to-actor role mapping. Actor roles are derived users, such as "Creator".

• wt.lifecycle.LoadLifeCycle.createCriterion

Creates permission criterion for life cycle phase.

• wt.lifecycle.LoadLifeCycle.createPhaseTemplateBegin and wt.lifecycle.LoadLifeCycle.createPhaseTemplateEnd

Creates a phase.

• wt.project.LoadProject.createProjectBegin and wt.project.LoadProject.createProjectEnd

Creates a project.

• wt.lifecycle.LoadLifeCycle.createWTAclEntry

Creates ad hoc access control for a life cycle phase.

• wt.content.LoadDataFormat.createDataFormat

Adds data formats used in load content files.

• wt.effectivity.LoadEffectivity.createConfigurationItem

Loads a configuration item. A configuration item is necessary for lot number effectivity and serial number effectivity, but is optional for date effectivity.

• wt.effectivity.LoadEffectivity.createWTDatedEffectivity

Loads a date effectivity. The effectivity will be associated with the WTPart object that was loaded last.

• wt.effectivity.LoadEffectivity.createWTSerialNumberedEffectivity

Loads a serial number effectivity. The effectivity will be associated with the WTPart object that was loaded last.

1-8 Windchill Data Loading Reference and Best Practices Guide

Page 21: Wc Data Load Guide

• wt.effectivity.WTLotEffectivity.createWTLotEffectivity

Loads a lot effectivity. The effectivity will be associated with the WTPart object that was loaded last.

• wt.inf.team.ix.LoadSharedTeam

Loads a shared team. Shared teams can be loaded into an organization container and are used as a way to centralize team administration across an organization. See More About wt.inf.team.ix.LoadSharedTeam for more information.

More About wt.doc.LoadDoc.beginCreateWTDocument

wt.doc.LoadDoc.beginCreateWTDocument supports versioning to allow a document to be created at a specified version and iteration. Multiple document versions imply an "order". For example, subsequent bulk load runs can "fill in the gaps", but it does so by attaching to the latest iteration of the previous version.

If a newer iteration is added to the previous version, the new version will be attached to the new latest iteration. For example:

Load set 1 (E.1, A.1, C.2) will result in (A.1, C.2, E.1).

The predecessors of: C.2 is A.1, E.1 is C.2.

Load set 2 (B.1, A.2., C.1, C.3) will result in (A.1, A.2, B.1, C.1, C.2, C.3, E.1).

The predecessors of: B.1 is A.2, C.1 is B.1, E.1 is C.3.

The Iteration History page of B.1 will show both A.2 and A.1

The Iteration History page of C.1 will show B.1, A.2 and A.1

The Iteration History page of E.1 will show C.3, C.2, C.1, B.1, A.2 and A.1

Any new version/iterations added will continue to change the predecessor links to the new latest iteration of the previous version.

Note: Versioning does support gaps in the ordering.

Examples of valid versioning are: (A.1,A.3,B.2,B.5,E.4,E.5)

More About wt.part.LoadPart.beginCreateWTPart

wt.part.LoadPart.beginCreateWTPart supports versioning. This allows a part to be created at a specified version and iteration. Multiple part versions imply an "order". For example, subsequent bulk load runs can "fill in the gaps", but it does so by attaching to the latest iteration of the previous version. If a newer iteration is added to the previous version, the new version will attached to the new latest iteration.

For example: Load set 1 (E.1, A.1, C.2) will result in (A.1, C.2, E.1).

Introduction to Data Loading and the LoadFromFile Framework 1-9

Page 22: Wc Data Load Guide

The predecessors of: C.2 is A.1, E.1 is C.2. Load set 2 (B.1, A.2., C.1, C.3) will result in (A.1, A.2, B.1, C.1, C.2, C.3, E.1).

The predecessors of: B.1 is A.2, C.1 is B.1, E.1 is C.3.

The Iteration History page of B.1 will show both A.2 and A.1

The Iteration History page of C.1 will show B.1, A.2 and A.1

The Iteration History page of E.1 will show C.3, C.2, C.1, B.1, A.2 and A.1

Any new version/iterations added will continue to change the predecessor links to the new latest iteration of the previous version.

Note: Versioning does support gaps in the ordering.

Examples of valid versioning are: (A.1,A.3,B.2,B.5,E.4,E.5)

When loading versions out of sequence and loading relationships to those parts there are a few things that you should understand while ordering your data:

• Relationships are copied forward from what is identified as the predecessor to the new version. So in an ordered case if you create part 1 A.1 that has references or a describe relationship to doc 2. Then you revise to get part 1 B.1, it will have the relationships of A.1 copied to it so it will have the relationship to doc 2 as well.

• Relationships are not copied forward if they are created after the new version has already been created. For example if part 1 A.1 and B.1 are created and then part A.1 has a relationship created to doc 2, part 1 B.1 will not have the relationship to doc 2 copied to it. You must explicitly create that relationship if you want it created.

• Relationships from predecessors are not cumulative. This is really just a further clarification of the first point. Relationships are only copied from the one identified predecessor and not the accumulation of predecessors. So if you create part 1 B.1 that is related to doc 2, create part 1 A.1 that is related to doc 3 and then create part 1 C.1 it will inherit the relationship to doc 2 only.

These are a few pointers to loading versions and relationships out of sequence. There are other scenarios given these basic rules that can also be imagined. Order the creation of versions/iterations and relationship very carefully in order to get the results that you intend.

More About wt.inf.team.ix.LoadSharedTeam

The load file must contain a set of tags that defines the team. For example, assume you want to import a shared team with the following information:

• Shared team name: Design Team

• Description: Corporate team members responsible for designs

1-10 Windchill Data Loading Reference and Best Practices Guide

Page 23: Wc Data Load Guide

• Owner: User doing the load. By default, the user performing the load becomes the owner. If you want to set a different owner, include the UID of the user in the csvsharedTeamOwner tag.

• Invitation: Welcome to the Design Team!

• The shared team is enabled and extendable

Then the content of the XML file you use to do the load is as follows:

<?xml version="1.0"?><!DOCTYPE NmLoader SYSTEM "standardX10.dtd"> <NmLoader> <csvCreateSharedTeam handler="wt.inf.team.ix.LoadSharedTeam.createSharedTeam"> <csvsharedTeamName>Design Team</csvsharedTeamName> <csvsharedTeamDescription>Corporate team members responsible for designs</csvsharedTeamDescription> <csvsharedTeamOwner></csvsharedTeamOwner> <csvsharedTeamInvitation>Welcome to the Design Team!</csvsharedTeamInvitation> <csvsharedTeamEnabled>true</csvsharedTeamEnabled> <csvsharedTeamExtendable>true</csvsharedTeamExtendable> </csvCreateSharedTeam> </NmLoader>

For information about shared teams, see the Windchill Business Administrator's Guide

Shared teams must be loaded into an existing organization container.

More About wt.part.LoadPart.createPartRepresentation

The XML elements used with wt.part.LoadPart.createPartRepresentation describe the representation being loaded. For example, assume you want to create a representation with the following information:

• Part number of the part to associate the representation: GC000001

• Version of the part to associate the representation: A

• Iteration of the part to associate the representation: 1

Note: Not providing a value implies latest iteration.

• Directory containing representation data to load: loadFiles\pdmlink\demodata\GolfCart\golf_cart.asm

Note: Path must start under <Windchill>.

• Representation name: Demo

• Representation description: Demo data

• This representation should be the default representation for the part.

Introduction to Data Loading and the LoadFromFile Framework 1-11

Page 24: Wc Data Load Guide

• Create thumbnail for representation: false

Note: The value does not need to be "true" if thumbnail is included in the csvrepdirectory.

• Store content in representation as a ProductView archive: false.

Note: This value should typically be false. Setting to true will allow a client to open this representation from ProductView as one file, rather than multiple. This can help in certain WAN environments.

• Part view: Design. View of the part for which you are creating the representation.

The content of the XML file is as follows:

<csvPartRepresentation handler="wt.part.LoadPart.createPartRepresentation" ><csvpartNumber>GC000001</csvpartNumber> <csvpartVersion>A</csvpartVersion><csvpartIteration>1</csvpartIteration><csvrepDirectory>loadFiles\pdmlink\demodata\GolfCart\

golf_cart.asm</csvrepDirectory><csvrepName>Demo</csvrepName><csvrepDescription>Demo data</csvrepDescription><csvrepDefault>true</csvrepDefault><csvrepCreateThumbnail>false</csvrepCreateThumbnail><csvrepStoreEdz>false</csvrepStoreEdz> <csvpartView>Design</csvpartView>

</csvPartRepresentation>

Note: The part must be created in the same load file or an existing part must be loaded into memory/cache before the part is referenced in the load file (see handler "wt.part.LoadPart.cachePart").

1-12 Windchill Data Loading Reference and Best Practices Guide

Page 25: Wc Data Load Guide

2Preparing Data for Loading

This chapter describes the data loading process and the tool options for cleansing legacy data prior to loading it to the Windchill database.

Section Page

The Data Loading Process...................................................................................2-2Data Cleansing: About the Tools Available........................................................2-3Working with a Sample Data Set ........................................................................2-7Creating Data Extraction and Format Requirements ..........................................2-8

2-1

Page 26: Wc Data Load Guide

The Data Loading ProcessThe data loading process is fluid and changes depending on the data requirements. The flow chart below shows a typical data loading process beginning with analysis of the legacy system, continuing with data cleansing and extraction of a sample data, and finishing with loading of data on to the live system. The steps in this process are colorcoded to show the relationship between the customer and PTC’s Global Service Representatives.

Tip: It is strongly recommended that PTC review the raw data prior to loading. This ensures that resource bundles are properly prepared and data is of expected format and length. When possible, data should be reviewed and evaluated prior to engagement activities. This also allows for proper time and resource estimates to be created.

In this process, there is a built in review process prior to loading the data. For example, a data file of parts can be examined to produce a unique list of Part Types. This list should then be compared against the PartTypeRB.rbInfo file. Similarly, a unique list of part quantities can be compared to the QuantityUnitRB.rbInfo file.

Tip: Data lengths should be examined as well. The Title field on the Document Data load file must be fewer than 60 characters is one example of checking data lengths.

2-2 Windchill Data Loading Reference and Best Practices Guide

Page 27: Wc Data Load Guide

The review process and data cleansing typically require the use of a tool to examine the data. The following section reviews the tools options for data cleansing.

Note: In the case of Windchill CounterPart, it can also serve as a conversion tool. Using a tool such as CounterPart provides a layer of abstraction and protects the customer from changing load file formats if the PTC loaders change. For more information on CounterPart, refer to Windchill CounterPart: Pros and Cons.

Data Cleansing: About the Tools AvailableA time consuming part of the data loading process is reviewing and cleansing the data and ensuring that it meets the data format requirements specified by the appropriate RBInfo files and DTDs.

Note: Data files must be in XML format and must comply with the DTD supplied with the Windchill installation (available from the standardX10 directory). Refer to Validating the XML Format for information on creating and validating XML data files.

The following sections provide the pros and cons of different tool options for cleansing the data.

Text Editors: Pros and Cons

Text editors, such as WordPad, Notepad, or TextPad are simple to use and readily available. They might be used when additional data conversion is not necessary and the size of the data file is small. They provide a quick view of what is about to be loaded.

Pros• Simple to use.

• Available on most operating systems.

• Provide a quick review of data.

• Minimal learning curve.

• Can be used for simple search and replace.

• No additional "coding" or preparation is required to view data in this tool.

• Works for XML, CSV, or other text files.

Preparing Data for Loading 2-3

Page 28: Wc Data Load Guide

Cons• Data validation not available.

• Additional Data transformation is not available.

• Not viable for large amounts of data.

Microsoft Excel: Pros and Cons

Customers may have routines to produce data in "flat file" format separated by a delimiter, perhaps a comma. Microsoft Excel is a good tool to use to view data in neatly organized rows and columns.

Pros• Simple to use.

• Usually available on most Windows operating system.

• Provides a quick review of data.

• Can be used for simple search and replace.

• Can develop formulas to validate data.

• Minimal learning curve.

• Ability to manually move columns, which limits additional data transformation.

• Data can be filtered and sorted. This provides an easy approach to identifying duplicate parts and documents as well as producing a list of items to add to Resource bundles.

• Data consistency.

Cons• Data must be parsed into columns manually (Data - Text To Columns).

• Limited to 65,536 rows of data per worksheet.

• Not available when working on non-Windows platforms.

• Requires that data be in row and column format.

2-4 Windchill Data Loading Reference and Best Practices Guide

Page 29: Wc Data Load Guide

Custom Code: Pros and Cons

Custom developed code can greatly enhance the load process. Developing XML transforms and or Java programs allows the customer to continually deliver data in the same format regardless of the desired load file format. With the introduction of containers, custom-built code can be used to separate data into groups of load files as is now required.

Custom Code is most likely to be used in conjunction with another tool, such as a text editor.

This approach is most likely used when the load file format is different than the format the data is provided in.

Pros• Can be developed with special rules for data validation.

• Transforms data from neutral (customer supplied) to load ready format.

• Allows for data segregation.

• Consistent and explainable outcomes, unlike manual manipulation involved with the use of a tool such as Excel where there is the potential for error.

• Transportable and shareable.

• Runs on multiple operating systems.

Cons• Tightly coupled to input and output. A change in the input or output will

require a change to the custom code.

• No user interface to review the data.

• Usually requires the use of an additional tool for reviewing data.

• Multiple skill sets are required.

• Combination of manual and programmatic efforts, after code is developed.

Preparing Data for Loading 2-5

Page 30: Wc Data Load Guide

Windchill CounterPart: Pros and Cons

Owners of Windchill PDMLink or another Windchill family product can utilize CounterPart to prepare product data for loading into these Windchill solutions.

CounterPart is well suited to working with product data, such as part and product attributes.

Use CounterPart as a staging area for data cleansing only. You should then save the data in CSV format and use the CSV2XML conversion utility to generate your XML. For more information on the CSV2XML utility, refer to Using the CSV2XML Utility and Validating the XML Format later in this guide.

Pros• Can be developed with special rules for data validation.

• Transforms data from neutral (customer supplied) to load ready format.

• Can add rules for data validation.

• Ideal for large data amounts.

• Presents data in a user interface much like Microsoft Excel.

• Formulas and filters can be applied on the fly.

• Consistent and explainable outcomes, unlike manual manipulation involved with the use of a tool such as Microsoft Excel where there is the potential for error.

• Transportable and shareable.

• Provides a single source for reviewing and classifying (segregating) data.

• All load ready data files can be produced at the same time.

Cons• Requires development of customer import and export transforms.

• Maintains steep learning curve.

• Requires multiple skill sets.

Using CounterPart to Load Windchill ClassificationsIf you are working with a Windchill classification, you can use CounterPart to make bulk changes to the classification. Using the Windchill Classification Administrator (in the Tools menu), you can check out, update, and then check in a Windchill classification on a live system. Refer to the CounterPart online help for more information on using the Windchill Classification Administrator.

2-6 Windchill Data Loading Reference and Best Practices Guide

Page 31: Wc Data Load Guide

The Windchill Standard Classification (WSC) is also available with CounterPart. The WSC is a compilation of classification nodes, attributes, and standard images that are ready to be used in CounterPart. You can use it as a starting point for the creation of your company-specific Windchill classification. The WSC provides a pre-assembled hierarchy including products from Mechanical, Electrical/Elec-tronic, and Information Technology domains.

Working with a Sample Data SetOnce you have identified the legacy systems and subject matter experts with whom you will be working, it is important to extract a sample data set for review.

For example, a data file of parts can be examined to produce a unique list of Part Types. This list should then be compared against the PartTypeRB.rbInfo file. Similarly, a unique list of part quantities can be compared to the QuantityUnitRB.rbInfo file.

The rbInfo files that ship with Windchill are located in the <Windchill>\src directory structure. These files contain out-of-the-box default values for various drop-down selection boxes and are useful in determining if additional values must be added.

A sample data set should be a single file that is representative of the entire data. You must identify the data types (for example, parts, documents, etc.) that will be included in the data set, as well as the size of the data set. In the case of multiple legacy systems, you should also determine whether the data on the systems will load independently or if they need to be combined, cleansed, and loaded together.

How the sample data set is extracted from the legacy system is dependent on the legacy system. It is preferable that the data set be in CSV format since CSV is easily converted to XML that can be validated against the Windchill standardX10.dtd.

Preparing Data for Loading 2-7

Page 32: Wc Data Load Guide

Creating Data Extraction and Format RequirementsData extraction and format requirements should be clearly communicated to the person doing the extraction. If once the data is extracted and validation shows errors or anomalies in the data, return to the process of developing these requirements to eliminate the anomalies.

The following is a list of common solutions for issues for data extraction and data formatting. They should be resolved in a requirements document for data extraction.

• Specify terminology in a table that maps the terms among the systems.

• Specify that data should be provided in text-based files readable by common programs such as Notepad, TextPad, WordPad, etc.

• Specify how files should be named (for example, customer_xxxx_yyyy.txt, where xxxx is the file type (part, BOM, document, etc.).

• Specify how data should be segregated (for example, by object type).

• If the data files will contain additional attributes that will need to be calculated or derived, these attributes should be identified.

• Specify how you want attributes (or fields) to be separated (for example, by a “~” (tilde)).

Developing Load Metrics

Once the sample data set has been successfully loaded, it is possible to calculate how long it took to load the data file. This allows you to calculate the total parts/minute for loading. You can extrapolate from these metrics the amount of time required to load all of the data. This may or may not affect scheduling of the load activities.

2-8 Windchill Data Loading Reference and Best Practices Guide

Page 33: Wc Data Load Guide

3Using the CSV2XML Utility and

Validating the XML Format

This chapter describes the CSV2XML utility required to convert CSV data files to XML format files, as well as a suggested process for validating the XML files.

Note: The data loader classes do not support CSV-formatted data files.

Section Page

About the CSV2XML Utility ..............................................................................3-2Converting CSV Files for Multibyte Operating Systems....................................3-2Converting CSV Files to XML Format Files ......................................................3-2Working with Larger Files ..................................................................................3-3CSV2XML Arguments........................................................................................3-3Validating the XML Format................................................................................3-5

3-1

Page 34: Wc Data Load Guide

About the CSV2XML UtilityThe CSV2XML is a command line utility that converts CSV formatted object files to XML. Windchill load files must be converted into XML format. The CSV2XML utility only works with files ending in "CSV".

Note: The CSV2XML utility does not generate XML for use by the LoadFileSet utility.

Converting CSV Files for Multibyte Operating SystemsWindchill supports international character sets and must share data across different environments. The Windchill load utilities require that the XML data files be encoded in UTF-8.

The CSV2XML utility can work with CSV files written in different encoding. The encoding of the source CSV file should be specified in the command line as follows:

windchill wt.load.util.CSV2XML -input <input csv file> -encoding <encoding of the input csv file>.

If the -encoding argument is not specified, the CSV2XML utility will use the operating system’s default encoding. The output XML file will be always in UTF-8.

Converting CSV Files to XML Format Files

Note: Before converting the CSV files, it may be necessary to update the CSV file to match the definitions in the csvmapfile.txt file. The files must contain all of the data required (for example, containers) before they are converted with the CSV2XML utility.

Your installed Windchill environment consists of a set of containers that hold all of the administrative areas (known as domains), rules, and data that make up the context from which Windchill users work. Throughout the user interface, Context is used to identify where in the framework specific rules, domains, and data reside. However, to create this environment, you load containers.

PTC recommends that you create your test data using the CSV file format and then use the conversion utility to convert it to XML as it is easier to create the data and less error prone in the CSV format.

The syntax for the CSV2XML utility is as follows:

windchill wt.load.util.CSV2XML -input[input file or directory] -output[output directory] -root[specifies the root directory]-help -encoding [encoding of the source CSV file]-mapfile [absolute path of the csvmapfile.txt] -delimiter [user specified delimiter] -preservespace [specifies if spaces should be preserved]

Refer to CSV2XML Arguments below for more information.

3-2 Windchill Data Loading Reference and Best Practices Guide

Page 35: Wc Data Load Guide

The data load utilities will expect to find the data files in the <LoadFromFile>/src/loadFiles directory. If you use all the defaults, then the command would look like:

windchill wt.load.util.CSV2XML

To convert a CSV file to an XML file1. Verify the CSV file matches the file description defined in the

<Windchill>/loadFiles/csvmapfile.txt file. Make changes accordingly.

2. Run CSV2XML utility to generate object XML files.

3. Validate the XML files against <Windchill>/loadXMLFiles\standardX10.dtd.This step is recommended to identify invalid file formats to avoid causing the file load process to fail.

Note: The Life Cycle Administrator requires that all Life Cycle objects be stored in the System cabinets. Do not change the System cabinet designation in the Life Cycle XML load files. Also, the data content in the XML files is case-sensitive.

Working with Larger FilesFor large input files, it may be necessary to increase the memory allocated. For example, if the general command to the run the utility is:

windchill wt.load.util.CSV2XML -input <file_name>.csv

Then, for large input files it may be necessary to allocate 512 MB of memory:

java -Xmx512m wt.load.util.CSV2XML -input <file_name>.csv

CSV2XML ArgumentsThe following table describes the arguments available to the CSV2XML utility.

Argument Description

input [input file name or directory name]

Specifies the file name of the CSV file or the directory where the CSV files are located.

Its path is relative to root. If a directory is specified, then all the files in the directory are converted. If a file is specified, then only the file is converted.

This argument is optional.

Using the CSV2XML Utility and Validating the XML Format 3-3

Page 36: Wc Data Load Guide

output [output directory] Specifies the directory where to place the output XML files.

When specified, this must be a directory; otherwise an error will occur if a file is specified. The directory must exist.

If the directory already contains an output file, the CSV file conversion will not occur and a diagnostic message is printed. A new file is created and the old file is renamed and backed up. The renaming is done by appending the date and time of the creation of the new file.

By default, this is the same as the root directory. This argument is optional.

root [directory] Specifies the root directory.

By default, the root directory is <Windchill>/src/loadFiles.

help (or h) Prints information about CSV2XML.

This argument is optional.

encoding Encoding of the source CSV file.

This argument is optional. If not specified, will use system default encoding

mapfile Absolute path of csvmapfile.txt file.

By default, the path is <Windchill>/src/loadFiles/csvmapfile.txt

delimiter Specifies the delimiter used in csv file, default value is "," (comma).

preservespace Specifies whether spaces in CSV file should be preserved.

Argument Description

3-4 Windchill Data Loading Reference and Best Practices Guide

Page 37: Wc Data Load Guide

Validating the XML FormatOnce the data file is extracted from the legacy system and converted to XML, it is important to validate the data file prior to attempting to load it to the Windchill system. Any XML editor that performs validation against a DTD, such as XMLSPY, can be used for validating data against the standardX10.dtd.

The csvmapfile.dtd file is located in:

<Windchill>\codebase\registry\ixb\dtds\standardX10.dtd

csvmapfile.dtd is not the complete DTD. For validation, the standardX10.dtd at <Windchill>\loadXMLFiles should be used.

Execute the UpdateEditDTDUtility to ensure standardX10.dtd is the most current version. See About UpdateEditDTDUtility for further information.

Ensure that the following line is in your XML data files:

<!DOCTYPE NmLoader SYSTEM "standardX10.dtd">

Selecting the Appropriate DTD at Runtime

DTDs are available for use during runtime of the LoadFromFile and LoadFileSet utilities. Refer to the Windchill installation for the complete list of DTDs. These DTDs are located in the <Windchill>\codebase\registry\ixb\dtds\standardX10.dtd directory:

• csvmapfile.dtd — DTD describing data converted from CSV format, as well as some basic definitions such as those for containers

• netmarkets.dtd — Provides Windchill ProjectLink definitions

• pdmlink.dtd — Provides Windchill PDMLink definitions

• coreobjects.dtd — DTD for Import/Export

• search.dtd — DTD for Import/Export of Saved Searches

• logiccomponent.dtd — Defines the configuration logic of the Generic Part

These DTDs are appended together at runtime and form a single DTD file. To specify the DTD in an XML data file, add the following line:

<!DOCTYPE NmLoader SYSTEM "standardX10.dtd">

Note: Internally, the load framework locates the directory <Windchill>\codebase\registry\ixb\dtds\standardX10.dtd and creates a combined DTD from all DTD files in the folder. Ensure that this folder does not contain backup files. All backups should be done to a separate location.

To obtain the validation DTD which is in sync with the runtime DTD, run the following command:

windchill wt.load.util.UpdateEditDTDUtility

Using the CSV2XML Utility and Validating the XML Format 3-5

Page 38: Wc Data Load Guide

About UpdateEditDTDUtility

To obtain the validation DTD that is in sync with the runtime DTD, execute the the UpdateEditDTDUtility. This propagates your changes to the following file:

<Windchill>\loadXMLFiles\standard<current_windchill_release>.dtd

Usagejava wt.load.util.UpdateEditDTDUtility <mode>_<Windchill>_<dtd_name>_<dtd_location><verbose>

Where:

mode = The default value for this parameter is USER.

Windchill = The Windchill home installation path.

dtd_name = The name of the DTD that needs to be updated, such as standardX10.dtd.

dtd_location = The directory location where the DTD resides or is created, if non-existent.

verbose = Executes the utility in debug mode.

Note: All arguments are optional; however, the order of the arguments should be preserved, if provided.

The utility accepts user inputs for both dtd_name and dtd_location. This mode allows the DTD updates for previous releases; also, by default, the current release DTD is updated. If no input is provided for the dtd_name and dtd_location parameters, the values for these are picked from the wt.properties through the properties com.ptc.netmarkets.ixb.dtdName and com.ptc.netmarkets.ixb.dtdLocation. If none of these are provided, defaults are assumed.

The default value for com.ptc.netmarkets.ixb.dtdName is <current_release>dtd.

The default value for com.ptc.netmarkets.ixb.dtdLocation is <Windchill>/load XMLFiles.

These properties can be specified in wt.properties.

Other features include:

• The utility backs up the existing DTD and creates a new updated DTD.

• If the dtd_location does not exist, it is created.

If no parameters are supplied, the usage would look like the following. In this case, the defaults above would be assumed for all parameters.

java wt.load.util.UpdateEditDTDUTILITY

3-6 Windchill Data Loading Reference and Best Practices Guide

Page 39: Wc Data Load Guide

The following example contains the default values:

For com.ptcnetmarkets.ixb.dtdName=standardX10dtd, the content of all the DTDs residing at <Windchill>/codebase/registry/ixb/dtds/standardX10.dtd is aggregated and copied to the standardX10.dtd residing at the location specified by com.ptcnetmarkets.ixb.dtdLocation=<Windchill>\loadXMLFiles.

Note: This utility works only for DTDs in the following directory:

<Windchill>/codebase/registry/ixb/dtds

Using XML Spy to Validate the Data Files

XML Spy allows for the orderly display and entry of XML data. Data can be displayed in standard text form, grid entry, or in browser mode. The following figure displays a user load file in table format (grid mode). Data can be entered directly in the grid mode.

Using the CSV2XML Utility and Validating the XML Format 3-7

Page 40: Wc Data Load Guide

To validate the proper format of a XML load file1. Open the XML file in XML Spy and assign the DTD using the Assign DTD

option as shown below:

2. Click Browse in the window that appears to locate and select the proper DTD.

3. Click OK to assign the DTD.

A warning appears stating that there is an external DTD already assigned.

4. Click OK to continue.

The validation displays in the lower pane.

3-8 Windchill Data Loading Reference and Best Practices Guide

Page 41: Wc Data Load Guide

4Loading Legacy Data Using theLoadFromFile and LoadFileSet

Utilities

This chapter describes the LoadFromFile and LoadFileSet utilities, the available arguments, and the load file sets that accompany your Windchill installation. It also reviews the process required to successfully load legacy data, beginning with a review of the container hierarchy.

Section Page

About Data Loading Utilities ..............................................................................4-2Using the LoadFromFile Utility ..........................................................................4-2Using the LoadFileSet Utility..............................................................................4-5About the Load Files ...........................................................................................4-6Loading Legacy Data ..........................................................................................4-8Working with Containers ....................................................................................4-9

4-1

Page 42: Wc Data Load Guide

About Data Loading UtilitiesIn addition to the demonstration data that PTC provides, you may also have legacy data that you would to add to the Windchill database. PTC provides two utilities to load legacy data; LoadFromFile and LoadFileSet.

LoadFromFile is a command line utility that is used to load a single, customized data file into the Windchill database. LoadFileSet is a command line utility that is used to load multiple, customized data files into the Windchill database. In both cases, the data files must reside on the Windchill server.

For information on which object types require the use of the Import/Export framework, refer to When to Use LoadFromFile and Import/Export earlier in this guide.

Note: The load utilities only process XML files. The CSV2XML utility is used to convert CSV files to XML formatted files. If your data is CSV formatted, then you can reformat it to XML using the CSV2XML utility before loading the data into the database. Refer to Converting CSV Files to XML Format Files earlier in this guide for more information.

Using the LoadFromFile UtilityThe LoadFromFile utility is a user-authenticated process. User authentication can be provided through the command line or through the pop-up window displayed by the utility.

Note: Only the site administrator should run the LoadFromFile utility. Most load tags provide a tag that allows the specification of the user id, which should be used to create the object being loaded.

The LoadFromFile syntax is:

windchill wt.load.LoadFromFile -d [data file name]-u [user name] -p [user password] -CONT_PATH [container path]

Note: On Windows operating systems, if a LoadFromFile argument includes spaces, you must enclose the argument in double quotes (" ") and precede the quotes (escaped) with a back slash (\). For example, where "part 4" includes spaces in the CONT_PATH argument:

windchill wt.load.LoadFromFile -d D:\Dev\LoadfileforTesting\Part.xml-CONT_PATH \"/wt.inf.container.OrgContainer=TST/wt.pdmlink.PDMLinkProduct=part 4\"

The following table lists the LoadFromFile arguments available.

4-2 Windchill Data Loading Reference and Best Practices Guide

Page 43: Wc Data Load Guide

LoadFromFile Arguments

Argument Description

d [data file name] Specifies the name of the object file that contains the objects to be loaded into the Windchill database.

It is recommended that you provide the full path name of the data file. The file must reside on the Windchill server.

This argument is required.

u [user name] Specifies the name of the user to authenticate the additions being made to the database.

The user argument is optional for the command line; however, the LoadFromFile utility will prompt for user authentication using a pop-up window.

This argument is optional.

p [user password] Specifies the password for the authenticating user.

The password argument is optional for the command line, however, the LoadFromFile utility will prompt for user authentication using a pop-up window.

This argument is optional.

CONT_PATH Specifies the target container for the data when the target container is not "Exchange".

By default, the target container is "Exchange".

This argument is optional.

Loading Legacy Data Using the LoadFromFile and LoadFileSet Utilities 4-3

Page 44: Wc Data Load Guide

Sample Command Lines

LoadFromFile is executed from the command line to load legacy data into the Windchill database.

It is recommended to supply the CONT_PATH parameter, however, if you specify only the required arguments, then the command would look like:

windchill wt.load.LoadFromFile -d [data file name]

If you specify all the arguments, then the command would look like:

windchill wt.load.LoadFromFile -d [data file name]-u [user name] -p [user password]-CONT_PATH [/wt.inf.container.OrgContainer=MyOrg/wt.inf.library.WTLibrary=MyLibrary]

More About CONT_PATH

CONT_PATH specifies the container path for the data when the target container is not "Exchange". The syntax to specify the container path may look like:

-CONT_PATH /wt.inf.container.OrgContainer=MyOrg

-CONT_PATH /wt.inf.container.OrgContainer=MyOrg/wt.pdmlink.PDMLinkProduct=Prod

-CONT_PATH /wt.inf.container.OrgContainer=MyOrg/wt.inf.library.WTLibrary=Lib

Note: When loading into a container, an implied / hidden folder called "Default" exists. To load into a folder other than the default folder, the following format should be used.

<folder>/Default/Widgets<folder>

4-4 Windchill Data Loading Reference and Best Practices Guide

Page 45: Wc Data Load Guide

Using the LoadFileSet UtilityThe LoadFileSet utility can be used when multiple data files are loaded into the database. The syntax for the LoadFileSet utility is as follows:

windchill wt.load.LoadFileSet -file [load file set path]-descr [load set description] -UAOps|UNATTENDED -NOSERVERSTOP

The following table lists the LoadFileSet arguments available.

LoadFileSet Arguments

Argument Description

file [load file set path] Specifies the absolute path name of the load file set.

This argument is required.

descr [load set description] Specifies a description of the load file set. The description is displayed by the installer along with the yes/no prompt.

For example:

Load <load file set path> <load set description>?

This argument is optional.

UAOps or UNATTENDED Specifies whether the install should run in unattended mode. You can specify either argument.

The installer will not elicit prompts to the typical questions it poses during the installation.

NOSERVERSTOP (or NoServerStop) Specifies whether the method server should be stopped and restarted after the load process completes.

If this argument is not specified, then the method server will be stopped and restarted by the installer.

This argument is optional.

Loading Legacy Data Using the LoadFromFile and LoadFileSet Utilities 4-5

Page 46: Wc Data Load Guide

About the Load FilesThere are two levels of XML files; the load file set and the object file. The load file set specifies the set of object files and the container to load the data into. The object file specifies the actual data of the objects to be loaded. The LoadFileSet utility expects the load file set as input, and the LoadFromFile utility expects object XML files as input.

Load File Set

A load file set specifies a set of object files and the container in which the objects are loaded into. The DTD file, WindchillLoad.dtd, for the load file set is located in the <Windchill>/codebase/wt/load/ directory. An example of the WindchillLoad.dtd is as follows:

<!ELEMENT loadFileList (loadFile*) >

<!ATTLIST loadFileList containerPath CDATA #IMPLIED >

<!ELEMENT loadFile EMPTY >

<!ATTLIST loadFile filename CDATA #REQUIRED

rbinfo CDATA #IMPLIED

key CDATA #IMPLIED

title CDATA #IMPLIED

token CDATA #IMPLIED

mapfile CDATA #IMPLIED

containerPath CDATA #IMPLIED >

LoadFileList XML ElementThis XML element contains the list of object XML files to load (specified in loadFile elements). LoadFileList has an attribute of containerPath:

ContainerPath — This parameter specifies the path of the container that the object files are to be loaded into. It is highly recommended that this value be set. By agreement, container path of Exchange (‘Site’) container is ‘/’. For other containers it has the form of /container-class=container-name/…/…

For example:

/wt.inf.container.OrgContainer=DefaultOrg/wt.inf.library.WTLibrary=Windchill PDM

/wt.inf.container.OrgContainer=pjl-qa/wt.projmgmt.admin.Project2=Project14

4-6 Windchill Data Loading Reference and Best Practices Guide

Page 47: Wc Data Load Guide

LoadFile ElementThis element specifies the object files that to load in the target container. It is an empty tag with the following attributes:

• filename — This is the name of the object file to be loaded. Its location is relative to the directory specified in wt.loadFiles property. Default is $(wt.home)/loadFiles.

• rbinfo — Where resource information is stored for the particular file. Used by the handlers.

• key — Localized title key.

• token — An exception will not be thrown if token is specified, but it will be ignored.

• mapfile — An exception will not be thrown if mapfile is specified, but it will be ignored.

containerPathIt is recommended that the set of objects to be loaded in a load set should all reside in a single container. However, you can specify an alternative containerPath that will cause the object in the current loadFile specification to go into a different container than the other LoadFile pointers in the set. This should only be specified under extraordinary circumstances.

Sample Load File Set

In the following load file set example, all the files are loaded into the exchange container:

<!DOCTYPE loadFileList SYSTEM "/wt/load/windchillLoad.dtd">

<loadFileList containerPath=”/ ”>

<loadFile filename="mydataformats.xml" title="data formats"/>

<loadFile filename="myadmin.xml" title="miscellaneous admin data and access rules"/>

<loadFile filename="myworkflow.xml" title="workflow base data"/>

</loadFileList>

Object XML Files

An object file contains actual data for the objects that are loaded into the Windchill database. The DTD file for them is <Windchill>/loadXMLFiles/standardX10.dtd. It is strongly recommended that you validate an object XML file against this DTD prior to loading the data because an invalid XML file will cause the load process to fail.

Loading Legacy Data Using the LoadFromFile and LoadFileSet Utilities 4-7

Page 48: Wc Data Load Guide

Sample Object FileThis is an example of what an object XML file may look like.

<?xml version="1.0" ?>

<!DOCTYPE NmLoader SYSTEM "standardX10.dtd">

<NmLoader>

<csvPreferenceInstance handler="wt.preference.LoadPreference.createPreferenceInstance">

<csvname>/Display/ToolbarDescriptions</csvname>

<csvclientName>WINDCHILL</csvclientName>

<csvvalue>true</csvvalue>

<csvlock>false</csvlock>

</csvPreferenceInstance>

</NmLoader>

Loading Legacy DataAs shown in the flowchart, The Data Loading Process, the process for loading legacy data can be long and detailed. However, depending on your situation, the order and number of steps required may change.

Prior to loading the legacy data, you should analyse the existing system, cleanse the data, and provide extraction rules to the customer. Once a sample data set is cleansed, extracted, and successfully loaded into Windchill, you can effectively estimate how long it will take to load the entire data and which legacy systems (if applicable) should be loaded and in which order.

Note: In some situations, it is necessary to compile the data from all legacy systems into one database and then prepare the data for loading to Windchill. In other cases, it is prudent to load the data from each legacy system independently. Carefully reviewing sample data from the legacy systems prior to beginning the load process is extremely important.

Once the sample data set has been loaded successfully, the process to load legacy data generally includes the following steps:

1. Back up the live Windchill system.

2. Freeze the legacy systems.

3. Extract the final data to be loaded.

4-8 Windchill Data Loading Reference and Best Practices Guide

Page 49: Wc Data Load Guide

4. Convert the data CSV to XML format, if required.

5. Load the data using LoadFromFile or LoadFileSet. Refer to the arguments tables in this chapter for more information.

Note: The following chapter provides detailed examples of how to load users, organizations, products, and libraries using the utilities in Step 5.

Working with ContainersYour installed Windchill environment consists of a set of containers that hold all of the administrative areas (known as domains), rules, and data that make up the context from which Windchill users work. Throughout the user interface, Context is used to identify where in the framework specific rules, domains, and data reside. However, to create this environment, you load containers.

There are three levels of containers: site, organization, and application contexts. After installing Windchill, it is recommended that the system administrator load demo data to ensure that the system is working. The Windchill Loader is used to load this data. Refer to the Windchill Installation and Configuration Guide -Advanced for more information on the Windchill Loader.

By default, the Windchill Loader creates the following containers:

• site container

• organization container

These containers are nested and create a hierarchy (that is, the organization container exists within the site container). The Windchill Loader only creates one of each container.

Containers in Windchill PDMLink

If you have installed a solution (for example, Windchill PDMLink), then there are minor differences in how the hierarchy must look. In order to load data into the appropriate container, you must be aware of the differences in the hierarchy. Data files must be prepared to load into the appropriate container. A separate file for each container is required and the container must be specified in the LoadFromFile command.

Note: Once all objects are loaded, you can load the structure separately using the AssemblyAddLoad tag.

Loading Legacy Data Using the LoadFromFile and LoadFileSet Utilities 4-9

Page 50: Wc Data Load Guide

Windchill PDMLink HierarchySite container

– Organization container(s)

• Product containers

• Library containers

◆ Documents

In the Windchill PDMLink hierarchy, there is a single site container and a single organization container when the solution is installed. You may create additional organization containers.

Within each organization container, there may be product and library containers. Business-level objects such as parts, documents, and CAD documents can be loaded into the product or library containers.

Multiple product containers can exist in one load file. Product containers belong to an organization, so when calling the load utility, the proper organization should be specified.

4-10 Windchill Data Loading Reference and Best Practices Guide

Page 51: Wc Data Load Guide

5Creating Load Methods

This chapter describes the procedure for editing the csvmapfile.txt file and for creating custom load methods.

Section Page

Customizing Loading ..........................................................................................5-2Modifying Data Files...........................................................................................5-3Creating New Methods for Loading....................................................................5-4

5-1

Page 52: Wc Data Load Guide

Customizing LoadingYou can customize loading by either changing the data in the data files provided in the Windchill\loadFiles directory or by adding new methods to load locally customized classes.

Changing the data in the files loads local data into existing classes. Refer to Modifying Data Files below for more information.

About the csvmapfile.txt File

The csvmapfile.txt file exists as an input to conversion utilities such as CSV2XML.

For more information on the CSV2XML utility, refer to the chapter, Using the CSV2XML Utility and Validating the XML Format earlier in this guide.

The csvmapfile.txt file is used to map the specific method call and the data fields to a line in the data file. The following is sample code from the map file:

#class,method,real method~attribute 1~attribute 2~&hellip;.~attribute nGeneral~create~wt.doc.LoadDoc.createGeneral~user~name~title ~number~type~description~department~saveIn~path~format ~project~domain~lifecycletemplate

Note: The preceding is only one line but wrapped here for readability. Continuation of lines is not accepted.

The first two fields, class and method, are the keys to the map file. Two keys are given to each line in the map file to allow multiple definitions for a given actual class in Windchill. This allows alternate names for one class, multiple functions for one class, or different input fields.

Both class and method are arbitrary strings. The class value matches the class in the data file. It is used only to match the map and data files so it can be any string as long as the same string is used in both. The method value matches the method variable passed either on the command line or as a parameter to doFileLoad.

The real method field is the fully qualified method name that load calls through introspection with the values from the data file. The attributes 1 through n match the text used in the real method. The order in the map file is used to retrieve the values from the data file.

The following are possible scenarios for modifying the csvmapfile.txt file:

• Data in the data file has the data fields in a different order. Edit the csvmapfile.txt to make the order the same as the data file. See Modifying Data Files below.

• You want to add a new site class. Create a new line in the map file with a new class, real method, and new attribute list. See Creating New Methods for Loading later in this chapter.

5-2 Windchill Data Loading Reference and Best Practices Guide

Page 53: Wc Data Load Guide

The line below an example of a line added to the csvmapfile.txt file for a new class:

NewClass~create~wt.doc.LoadDoc.createNewClass~user~name~title ~number~type~description~department~my_new_attribute~saveIn ~path~format~project~domain~lifecycletemplate

Note: Do not put blank lines in the map file. One or more empty lines between entries cause the load to fail.

Modifying Data FilesThe data file is used to provide the load with data. This section outlines the steps required to modify XML data files. There are two methods to choose from.

Method 1: Modifying XML Load Files Directly

Before you begin the following procedure, ensure that you have an installation of XMLSpy or another XML editor that can validate the XML against a DTD.

1. Make your changes to the \Windchill\loadFiles\csvmapfile.txt file.

2. Add the required DTD elements to the csvmap.dtd and generate the runtime validation DTD through the wt.load.util.UpdateEditDTDUtility.

The runtime DTD is generated at <Windchill>\codebase\registry\ixb\dtds\standardX10.dtd. Your changes are propagated to the <Windchill>\loadXMLFiles\standardX10.dtd file.

For more information, see About UpdateEditDTDUtility.

Note: The csvmapfile.dtd file is a partial DTD and therefore cannot be used for validation. To obtain DTD file for validation, run Windchill wt.load.util.UpdateEditDTDUtility.

3. Using an XML editor, make changes to the XML data files and validate them against the DTD obtained in Step 2.

Creating Load Methods 5-3

Page 54: Wc Data Load Guide

Method 2: Modifying CSV Files and Propagating Changes to XML and DTD Files

With this approach, you work with the CSV (Comma Separate Value) files and use automated tools to generate XML load files and the DTD file.

To propagate changes to XML and DTD1. Make your changes to the CSV data file.

2. Make your changes to \Windchill\loadFiles\csvmapfile.txt.

3. Modify the csvmapfile.dtd as required based on your changes.

4. Run the following utility to update the /loadXMLFiles/standardX10.dtd file to reflect your changes:

windchill wt.load.util.UpdateEditDTDUtility

5. Run the following utility to generate XML load files:

windchill wt.load.util.CSV2XML -input [optional] -output [optional] -root [optional] -h [optional] –encoding [optional]-mapfile [absolute path of the csvmapfile.txt] -delimiter [user specified delimiter] -preservespace [specifies if spaces should be preserved]

For details on the CSV2XML arguments, see CSV2XML Arguments.

6. Validate the XML file against the DTD and test your changes.

Creating New Methods for LoadingYou may need to create a new method or class for a new Windchill loader. Any modifications should be done in the csvmapfile.dtd and the new loader class and its corresponding method’s information should be registered in the csvmapfile.txt. Updating the csvmapfile.txt is important for the former and DTD to remain synchronized.

Note: The source code for the LoadDoc and LoadPart loaders is available for customization. You can create new methods for loading by editing this source code. Refer to the appropriate section below.

About Load Methods

All the methods that are called by the load framework follow the same signature:

public static boolean myMethod (HashTable nv, HashTable cmd_line, Vector v)

5-4 Windchill Data Loading Reference and Best Practices Guide

Page 55: Wc Data Load Guide

The method should return true if the function is successful, and false if it is not. The parameters are as follows:

• The nv parameter is a hash table of the attribute names from the map file as the keys and the corresponding strings from one line of the data file as the value.

• The cmd_line parameter is a hash table of the extra attributes from the command line (parameters not defined in the interface). This allows substitution of values from the command line into the data file at runtime.

• The return_objects parameter is a vector of the objects created or worked upon by the createNewClass method. After the object is manipulated, add it to the vector; for example:

return_objects.addElement(doc);

This vector is used to give more informative messages back to the command line. If the object that was manipulated by this method does not implement getIdentity or that information would not be useful in a message to the command line, a string should be added to the return_object instead; for example:

String msg = "Type = Content Item, Identity = " + appData.getFileName(); return_objects.addElement(msg);

Resolving DataThere is a utility that resolves the data from the data file and the data from the command line. For example, to retrieve a value for the new attribute that was added for NewClass, use the following:

String my_attribute = LoadServerHelper.getValue("my_new_attribute", nv,cmd_line,LoadServerHelper.REQUIRED);

The first parameter is the string from the map file. The last parameter is used to indicate if the field is required, not required, or blank okay.

If the field is required or the load should fail, use LoadServerHelper.REQUIRED and check if the return value is null. LoadServerHelper.getValue generates an error message if the value is required and the field value is null or an empty string.

If the field is not required and you want the return set to null for no value or empty strings, use LoadServerHelper.NOT_REQUIRED.

If you want to know the difference between no value being given for a field and an empty string, use LoadServerHelper.BLANK_OKAY. The blank okay option returns null if the attribute is not found in the hash table, meaning there could be a format issue with the map and data files. The blank okay option returns "if the attribute is found in the hash table but the value was blank, which, depending on the attribute, could be okay."

Creating Load Methods 5-5

Page 56: Wc Data Load Guide

Additional Utilities within a MethodThe following are utilities or helper methods for use within a method:

• The LoadServerHelper.getTargetContainer() method can be used to get a target container for a load. This is the container specified in the load file set, or, if using LoadFromFile, it is specified using the -CONT_PATH command line option.

If no container was specified, it will display a warning message and try to use "Exchange" container.

• The LoadServerHelper.getTargetDomain() method can be used to get a target domain for a load. The input file may specify the domain path as follows:

– Full path ('/System') -- In this case, it will look in the target container and then in Exchange.

– Container qualified path ('[/]/System') -- If the container is a parent organization for the target container, you may use [/Org] for container path part.

– For migration purposes, it also supports domain name ('System'). If domain name is a special domain, it will return this domain. Otherwise, it will return the domain with the root parent in the Exchange container.

• The LoadServerHelper.changePrincipal(user) method can be used to change the effective user for a set of actions. This can be used only if the user who was authenticated for this session is a member of the administrative group. Upon completion of processing one line of data, the load utility sets the principal back to the original one, if the method it called changed the principal.

• The LoadServerHelper.removeCacheValue(MY_KEY) method and LoadServerHelper.setCacheValue(MY_KEY,my_object) method can be used to cache objects between calls to a specific method or calls to different methods. The load utility calls one method per line in the data file. Loading documents and then loading multiple content files into a document is one example of first creating a document, caching it, and returning to the load. The load then reads in the next data line, which is a content line.

• The LoadContent method retrieves the cached data as follows:

ContentHolder contentHolder = (ContentHolder)LoadServerHelper.getCacheValue(CURRENT_CH_KEY);

This method adds the content file to the document. If you are creating an object that can hold content (files and URLs) and you want to load multiple content items on lines following the object in the data file, you must cache the object using the following constant:

private static String CURRENT_CH_KEY = "Current ContentHolder";

5-6 Windchill Data Loading Reference and Best Practices Guide

Page 57: Wc Data Load Guide

If you want to cache an object for another reason, you must create a unique key string. It is recommended that you clear your cached object at the beginning of the next create so that if the create fails, the next operation depending on it will fail and not corrupt other data. The cache of all objects is cleared after the last data line is processed.

Note: The cache does not do garbage collection by itself. If you cache lots of items with different keys and run the method multiple times through a load file, this will limit the size of your load file because you can run out of memory.

Creating a Document Class

PTC supports two types of customization of the document class; a modeled/hard type and a soft type.

If you add a soft type or soft attributes to WTDocument, then the existing load methods do not require any customization. However, if you add a modeled or hard type customization to WTDocument, then a new load method is required.

To customize wt.doc.LoadDoc to work with new modeled subclasses of WTDocument, search LoadDoc for the factory method that creates the new instance of the Document.

The statement is as follows:

document = WTDocument.newWTDocument in the constructDocument method

Change the above statement to handle the new modeled class. Also, you should search for the applyHardAttributes method and add the setting of any modeled attributes.

Note: wt.doc.LoadDoc can handle loading out of sequence iterations and versions. Refer to the JavaDoc for information on the beginCreateWTDocument class.

Creating a Part Class

PTC supports two types of customization of the part class: a modeled/hard type and a soft type.

If you add a soft type or soft attributes to WTPart, then the existing load methods do not require any customization. However, if you add a modeled or hard type customization to WTPart, then a new load method is required.

To customize wt.part.LoadPart to work with new modeled subclasses of WTPart, search LoadPart for the factory method that creates the new instance of the part.

The statement is as follows:

part = WTPart.newWTPart in the constructPart method

Creating Load Methods 5-7

Page 58: Wc Data Load Guide

Change the above statement to handle the new modeled class. Also, you should search for the applyHardAttributes method and add the setting of any modeled attributes.

Note: wt.part.LoadPart can handle loading out of sequence iterations and versions. Refer to the JavaDoc for information on the beginCreateWTPart class.

5-8 Windchill Data Loading Reference and Best Practices Guide

Page 59: Wc Data Load Guide

6Loading Product Objects and

Parts: Windchill PDMLinkExample

This chapter provides a detailed example of the data loading process for users, product objects, and parts. It begins by creating organizations, product containers, and library containers in a Windchill PDMLink system.

Section Page

Before You Begin................................................................................................6-2Loading Users......................................................................................................6-4Creating Organizations........................................................................................6-4Creating Product Containers ...............................................................................6-5Creating Library Containers..............................................................................6-10Loading Product Objects and Parts ...................................................................6-14Loading Relationships Between Parts and Documents.....................................6-20

6-1

Page 60: Wc Data Load Guide

Before You BeginThe examples in this chapter assume that the legacy data is being delivered in a Comma Separated Value (csv) format. The legacy data has been extracted and formatted as required by the loaders. XML and Java may have been used to transform the data from the extracted format into the proper format to load into Windchill (XML). Refer to Using the CSV2XML Utility and Validating the XML Format for more information.

Note: Containers improve the organization of Windchill system. In the Windchill user interface, containers appear to the user as "contexts". There are three levels of containers: site, organization, and business object. Refer to Working with Containers in the previous chapter for a more detailed description of containers and how they must be organized for Windchill PDMLink systems.

Specifying Types

When specifying types as values, a loader assumes the type is specified using a special format of the type that includes the fully qualified path to the type.

The format for a fully qualified type is as follows:

WCTYPE|<model_type>|<subtype1>|<subtype2>|...|<subtypeN>

where <model_type> is lowest level modeled type shown in the Type Manager that is a parent to the type being specified and <subtype1>, <subtype2>, etc. are the subtypes that are parent types related to <subtypeN>.

For all types used in this format, the type specified is the name of the type as listed in the Type Manager Name field. To view the name for each type, start the Type Manager, select the type in the panel on the left, and view the name from the General tab.

Running the LoadFromFile Utility

The LoadFromFile utility is called from a batch file. Within the batch file, a variable is established to identify the organization. This variable is then used throughout the load process.

The load program is: wt.load.LoadFromFile. It has the following arguments:

-d data filename

-u user name

-p user password

-<var name> <var value>

To specify a target container, you may also use:

-CONT_PATH <target_container_path>

6-2 Windchill Data Loading Reference and Best Practices Guide

Page 61: Wc Data Load Guide

The load utility is prefixed by "windchill".

An example command would be:

windchill wt.load.LoadFromFile -d mydata.xml

Tip: Run the utility from the same directory where the data file resides.

Loading Windchill PDMLink Products

In Windchill PDMLink, there are essentially two classifications of a product —Windchill PDMLink Product and WTProduct. Essentially the Windchill PDMLink Product is the container under the organization container. This is what is visible when viewing the Product tab in Windchill PDMLink. Essentially, what you need to do is create a Windchill PDMLink product container.

In the following example, the XML code creates a product called LoadTest1. This product will be visible when viewing the Organization tab. Assuming you have an organization called MyOrg, then you will complete following steps:

1. To load the Windchill PDMLink Product Container called LoadTest1, create an XML file similar to the following example:

Example<?xml version="1.0"?><!DOCTYPE NmLoader SYSTEM "standardX10.dtd"><NmLoader><csvProductContainer handler="wt.part.LoadPart.createProductContainer" >

<csvuser></csvuser><csvname>TestLoad1</csvname><csvsharedTeamName>Shared Team 2</csvsharedTeamName><csvcontainerExtendable>true</csvcontainerExtendable><csvnumber>TestLoad1</csvnumber><csvdescription>Test</csvdescription><csvview></csvview><csvsource></csvsource><csvdefaultUnit></csvdefaultUnit><csvtype></csvtype><csvcontainerTemplate>General Product</csvcontainerTemplate>

</csvProductContainer></NmLoader>

<csvsharedTeamName>Shared Team 2</csvsharedTeamName> and <csvcontainerExtendable>true</csvcontainerExtendable> are optional. Include these only when you want to include a shared team in your load data.

2. Use the following command to load this XML file into the organization called MyOrg:

Note: You must run this command as a user who belongs to the Site Administrator group.

Loading Product Objects and Parts: Windchill PDMLink Example 6-3

Page 62: Wc Data Load Guide

D:\9.0\Windchill>windchill wt.load.LoadFromFile -d d:\9.0\Windchill\loadFiles\ProductContainerLoad.xml -CONT_PATH \"/wt.inf.container.OrgContainer=MyOrg\"

d:\9.0\Windchill\loadFiles\TestProductLoad.xml -CONT_PATH \"/wt.inf.container.OrgContainer=MyOrg/wt.pdmlink.PDMLinkProduct=TestLoad1\"

The product called TestLoad1 should now be visible in the Product tab.

Loading UsersOnce converted from the legacy data format, the data file can be processed as is without additional modification.

Tip: Prior to processing the load file, validate that all users belong to the proper organization and have an e-mail address. This is done by examining the load file prior to processing.

In most circumstances, the <csvOrganization>My Organization</csvOrganization> entry of the load file should match the organization into which you want to load data.

Tip: It is important that users have an e-mail address. Without an e-mail address entry, users will not show up in the Find Users dialog box.

Loading Users: Sample CommandTo process the load file, it is not necessary to specify a container.

windchill wt.load.LoadFromFile -d users.xml -u wcadmin -p wcadmin -CONT_PATH/

Creating OrganizationsFollowing is a sample command:

windchill wt.load.LoadFromFile -d organization.xml -u wcadmin -p wcadmin -CONT_PATH/

Loading Organization Containers

When you are loading an organization container, you can set the following additional properties:

OrganizationAddress(org.setLocation(organizationAddress))

ConferencingID(org.setConferencingIdentifier

Note: These are not required. Existing loadfiles should work just fine.

6-4 Windchill Data Loading Reference and Best Practices Guide

Page 63: Wc Data Load Guide

ExampleFollowing is an example of a demo loadfile to load organizations. Included are the additional organization properties.

<csvOrgContainer handler="wt.inf.container.LoadContainer.createOrgContainer <csvcontainName>Demo Organization</csvcontainerName> <csvcontainerTemplateRef>Demo Template<csvcontainerTemplateRef> <csvbusinessNamespace>true</cvsbusinessNamesspace> <csvsharingEnabled>true</csvsharingEnabled> <csvcreator></csvcreator> <csvowner></csvowner <csvsubscriber>true</subscriber <csvconferencingURL></csvconferencingURL> <csvdescription>DemoOrganization</csvdescription> <csvinternetDomain></csvinternetDomain> <csvOrganizationAddress>123 Demo Drive</csvOrganizationAddress> <csvconferencingID>12345</csvconferencingID></csvOrgContainer

Tag Descriptions

• <csvcontainerName>: The name of the organization.

• <csvconatainerName>: The name of the organization template to use for creation of the or container.

• <csvbusinessNamespace>: Specifies whether or not the container is a business namespace. Containers that are namespaces constrain the identity of the objects in the container.

• <csvsharingEnabled>: Specifies whether or not objects in the container can be shared.

• <csvcreator>: The name of the user to assign as the creator of the container.

• <csvowner>: The name of the user to assign as the owner of the container.

• <csvsubscriber>: Indicates whether or not the organization can host projects, products, and libraries.

• <csvconferencingURL>: The conferencing URL for the organization container.

• <csvdescription>: The description of the organization container.

• <csvinternetDomain>: The internet domain of the organization container.

Creating Product ContainersIn Windchill 9.0, a "Product Container" can be created in one step. In this example, the customer had already prepared a load file for products based upon an earlier Windchill load process.

Loading Product Objects and Parts: Windchill PDMLink Example 6-5

Page 64: Wc Data Load Guide

For general administrative information on containers, refer to the chapter, Administering Containers, in the Windchill Business Administrator’s Guide.

Following is that process flow:

1. To use the proper data from the customer, the data file was converted to XML using the CSV2XML utility. See the following example:

Example<?xml version="1.0" ?><!DOCTYPE NmLoader SYSTEM "standardX10.dtd"><NmLoader><csvProductContainer handler="wt.part.LoadPart.createProductContainer">

<csvuser><wcadmin</csvuser><csvname>TestLoad3</csvname><csvpnumber>TestLoad3</csvnumber><csvsharedTeamName>Shared Team 2</csvsharedTeamName><csvcontainerExtendable>true</csvcontainerExtendable><csvdescription>Test</csvdescription><csvview></csvview><csvsource></csvsource><csvdefaultUnit></csvdefaultUnit><csvtype></csvtype><csvcontainerTemplate>General Product</csvcontainerTemplate>

</csvProductContainer></NmLoader>

<csvsharedTeamName>Shared Team 2</csvsharedTeamName> and <csvcontainerExtendable>true</csvcontainerExtendable> are optional. Include these only when you want to include a shared team in your load data.

2. After the data was updated, it was processed using a custom built XSL stylesheet. See the following example:

<?xml version="1.0" encoding="iso-8859-1"?><xsl:stylesheet

version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" indent="yes" encoding="iso-8859-1" doctype-system="standardX10.dtd" /><xsl:template match="/"> <NmLoader> <xsl:for-each select="//csvProduct"> <csvProductContainer handler="wt.part.LoadPart.createProductContainer" >

<csvname><xsl:value-of select="csvpartNumber"/></csvname><csvnumber><xsl:value-of select="csvpartNumber"/></csvnumber><csvsharedTeamName>Shared Team 2</csvsharedTeamName><csvcontainerExtendable>true</csvcontainerExtendable><csvdescription><xsl:value-of select="csvpartName"/></csvdescription><csvview></csvview><csvsource></csvsource><csvdefaultUnit></csvdefaultUnit><csvtype></csvtype>

6-6 Windchill Data Loading Reference and Best Practices Guide

Page 65: Wc Data Load Guide

<csvcontainerTemplate>General Product</csvcontainerTemplate> </csvProductContainer> </xsl:for-each> </NmLoader></xsl:template></xsl:stylesheet>

<csvsharedTeamName>Shared Team 2</csvsharedTeamName> and <csvcontainerExtendable>true</csvcontainerExtendable> are optional. Include these only when you want to include a shared team in your load data.

Tip: Although not illustrated in this example, XML code may be developed to test data and validate it. For example, if a value is empty but is really required, a default value could be substituted.

3. After using the XML code above, a load-ready file is produced. Product containers belong to an organization, so when calling the load utility, the proper organization should be specified.

When running the load utility for product containers, a user must be specified. It is a requirement that this user be a Product Creator for the specified organization. In addition, they should belong to the Administrator group. This is usually done manually.

Multiple product containers can exist in one load file.

Following is an example of a command line:

windchill wt.load.LoadFromFile -d product_container.xml -u wcoracle -p wcoracle -CONT_PATH \"/wt.inf.container.OrgContainer=My Organization\"

Tip: When calling wt.load.LoadFromFile in UNIX and the container has a space in the name, place quotes around the container. In addition, be sure to escape the quotes with a back slash.

Tip: To specify alternate Default values, adjust the Product (End Item) Initialization Rules from the Site Tab within Windchill PDMLink.

ExampleFollowing is an example of a batch file:

echo *************************************************

echo ** Variable Setup

echo *************************************************

set tmp_org="/wt.inf.container.OrgContainer=My Organization"

echo *************************************************

echo ** Legacy Products Containers

Loading Product Objects and Parts: Windchill PDMLink Example 6-7

Page 66: Wc Data Load Guide

echo *************************************************

windchill wt.load.LoadFromFile -d product_container.xml -u wcoracle -p wcoracle -CONT_PATH \%tmp_org%

Creating Assemblies

Creating assemblies is necessary for creating Products that use parts which may be common to other products, or may exist independently in other libraries.

The first thing that should be noted is that the <csvAssemblyAddLoad> tag can be used only with existing parts. In other words, it can only be used to create new assemblies using existing parts. The <csvAssemblyAddLoad> cannot be used to create a brand new part.

For that purpose, the following file:

<csvBeginWTPart handler="wt.part.LoadPart.beginCreateWTPart">?

must first be used to create the part and then add constituent parts. In this example there are two approaches.

Adding Pre-Existing Parts to a Another Part that Exists in a ProductThis example assumes the following:

• Part-1 exists in the product, MyProduct-1. This part may have been loaded previously, or added through the user interface.

• ExistingPart-1 and ExistingPart-2 reside in some other product or library.

• MyProduct-1 exists in the organization, MyOrg.

• The XML data resides in the file, DataFile.xml.

Given the above assumptions, the load can be performed using the following command:

windchill wt.load.LoadFromFile -d DataFile.xml -u wcadmin -p wcadmin -CONT_PATH /wt.inf.container.OrgContainer=MyOrg/wt.pdmlink.PDMLinkProduct=MyProduct-1

ExampleThe following is an example data file:

<?xml version="1.0"?><!DOCTYPE NmLoader SYSTEM "standardX10.dtd"><NmLoader>

<csvAssemblyAddLoad handler="wt.part.LoadPart.addPartToAssemblyLoad"><csvassemblyPartNumber>0000000022</csvassemblyPartNumber><csvconstituentPartNumber>0000000002</csvconstituentPartNumber><csvconstituentPartQty>1</csvconstituentPartQty><csvconstituentPartUnit>ea</csvconstituentPartUnit><csvassemblyPartVersion>D</csvassemblyPartVersion><csvassemblyPartIteration>1</csvassemblyPartIteration<csvassemblyPartView>Manufacturing</csvassemblyPartView><csvorganizationName></csvorganizationName>

6-8 Windchill Data Loading Reference and Best Practices Guide

Page 67: Wc Data Load Guide

<csvorganizationID></csvorganizationID></csvAssemblyAddLoad>

</NmLoader>

Creating a New Part Called LoadedAssm-1 and Adding Existing Parts as Constituent Parts

This example assumes the following:

• ExistingPart-1 resides in some other product or library.

• MyProduct-1 exists in the organization, MyOrg.

• The XML data resides in the file, DataFile.xml.

Given the above assumptions, the load can be performed using the following command:

windchill wt.load.LoadFromFile -d DataFile.xml -u wcadmin -p wcadmin -CONT_PATH /wt.inf.container.OrgContainer=MyOrg/wt.pdmlink.PDMLinkProduct=MyProduct-1

ExampleThe following is an example data file:

<?xml version="1.0"?><!DOCTYPE NmLoader SYSTEM "standardX10.dtd"><NmLoader> <csvBeginWTPart handler="wt.part.LoadPart.beginCreateWTPart" > <csvuser></csvuser> <csvpartName>LoadedAssm-1</csvpartName> <csvpartNumber>LoadedAssm-1</csvpartNumber> <csvtype>separable</csvtype> <csvsource>make</csvsource> <csvfolder>/Default</csvfolder> <csvlifecycle>Default</csvlifecycle> <csvview></csvview> <csvteamTemplate>System.TestTeamForLoads</csvteamTemplate> <csvlifecyclestate>INWORK</csvlifecyclestate> <csvtypedef></csvtypedef> <csvversion></csvversion> <csviteration></csviteration> <csvparentContainerPath></csvparentContainerPath> </csvBeginWTPart> <csvEndWTPart handler="wt.part.LoadPart.endCreateWTPart" > <csvpublishFlag></csvpublishFlag> <csvparentContainerPath></csvparentContainerPath> </csvEndWTPart> <csvAssemblyAddLoad handler="wt.part.LoadPart.addPartToAssemblyLoad" > <csvassemblyPartNumber>LoadedAssm-1</csvassemblyPartNumber> <csvconstituentPartNumber>ExistingPart-1</csvconstituentPartNumber> <csvconstituentPartQty>1</csvconstituentPartQty> <csvconstituentPartUnit>ea</csvconstituentPartUnit> </csvAssemblyAddLoad></NmLoader>

Loading Product Objects and Parts: Windchill PDMLink Example 6-9

Page 68: Wc Data Load Guide

Creating Library ContainersAssuming the XML data below resides in a file called DataFile, it can be used to load a library with the following command:

windchill wt.load.LoadFromFile -d DataFile.xml -u wcadmin -p wcadmin -CONT_PATH /wt.inf.container.OrgContainer=MyOrg

ExampleThe following is an example data file:

<?xml version="1.0"?><!DOCTYPE NmLoader SYSTEM "standardX10.dtd"><NmLoader> <csvContainer handler="wt.inf.container.LoadContainer.createContainer"> <csvcontainClass>wt.inf.library.WTLibrary</csvcontainerClass>

<csvcontainerName>Loaded Library</csvcontainerName><csvsharedTeamName>Shared Team 2</csvsharedTeamName><csvcontainerExtendable>true</csvcontainerExtendable><csvparentContainerPath></csvparentContainerPath><csvcontainerTemplateRef>General Library</csvcontainerTemplateRef><csvbusinessNamespace>false</csvbusinessNamespace><csvsharingEnabled>true</csvsharingEnabled><csvcreator></csvcreator><csvowner></csvowner><csvsubscriber>true</csvsubscriber><csvconferencingURL></csvconferencingURL><csvdescription>Loaded library</csvdescription><csvorganization></csvorganization><csvcreatorSelector></csvcreatorSelector>

</csvContainer></NmLoader>

<csvsharedTeamName>Shared Team 2</csvsharedTeamName> and <csvcontainerExtendable>true</csvcontainerExtendable> are optional. Include these only when you want to include a shared team in your load data.

ExampleThe following is an example batch file:

echo *************************************************

echo ** Variable Setup

echo *************************************************

set tmp_org=/wt.inf.container.OrgContainer=My Organization

echo *************************************************

echo ** Load Libraries

echo *************************************************

windchill wt.load.LoadFromFile -d libraries.xml -u wcadmin -p wcadmin -CONT_PATH \"%tmp_org%\"

6-10 Windchill Data Loading Reference and Best Practices Guide

Page 69: Wc Data Load Guide

Tip: Utilize the "-u" and the "-p" parameters in batch files to eliminate the Logon dialog box.

Loading Documents in a Library

The following is an example of how to load documents in to a library. In this example, there is a library named TestIssues in an organization called MyOrg.

Example<?xml version="1.0" ?><!DOCTYPE NmLoader SYSTEM "standardX10.dtd"><NmLoader><csvBeginWTDocument handler="wt.doc.LoadDoc.beginCreateWTDocument" > <csvname>Test Doc 11</csvname> <csvtitle>Test Doc 11</csvtitle> <csvnumber>TD11</csvnumber> <csvtype>Document</csvtype> <csvdescription>description text</csvdescription> <csvdepartment>DESIGN</csvdepartment> <csvsaveIn>/Default</csvsaveIn> <csvteamTemplate></csvteamTemplate> <csvdomain></csvdomain> <csvlifecycletemplate></csvlifecycletemplate> <csvlifecyclestate></csvlifecyclestate> <csvtypedef></csvtypedef> <csvversion>A</csvversion> <csviteration>1</csviteration></csvBeginWTDocument>

<csvEndWTDocument handler="wt.doc.LoadDoc.endCreateWTDocument" > <csvprimarycontenttype>ApplicationData</csvprimarycontenttype> <csvpath>DGadReq.doc</csvpath> <csvformat></csvformat> <csvcontdesc></csvcontdesc> <csvparentContainerPath></csvparentContainerPath></csvEndWTDocument></NmLoader>

The following command can then be used to load a document with name Test Doc 11 and number TD11 into the root folder of the library called TestIssues:

D:\9.0\Windchill>windchill wt.load.LoadFromFile -d d:\9.0\Windchill\loadFiles\TestDoc.xml -CONT_PATH \ "/wt.inf.container.OrgContainer=MyOrg/wt.inf.library.WTLibrary=TestIssues\"

Note: If you want to load the document in a subfolder called Folder1 in the library, then you would use the following for the csvSaveIn field of the XML file: /Default/Folder1

Given this, the XML file would appear as the following example:

Loading Product Objects and Parts: Windchill PDMLink Example 6-11

Page 70: Wc Data Load Guide

Example<?xml version="1.0" ?><!DOCTYPE NmLoader SYSTEM "standardX10.dtd"><NmLoader><csvBeginWTDocument handler="wt.doc.LoadDoc.beginCreateWTDocument" > <csvname>Test Doc 11</csvname> <csvtitle>Test Doc 11</csvtitle> <csvnumber>TD11</csvnumber> <csvtype>Document</csvtype> <csvdescription>description text</csvdescription> <csvdepartment>DESIGN</csvdepartment> <csvsaveIn>/Default/Folder1</csvsaveIn> <csvteamTemplate></csvteamTemplate> <csvdomain></csvdomain> <csvlifecycletemplate></csvlifecycletemplate> <csvlifecyclestate></csvlifecyclestate> <csvtypedef></csvtypedef> <csvversion>A</csvversion> <csviteration>1</csviteration></csvBeginWTDocument>

<csvEndWTDocument handler="wt.doc.LoadDoc.endCreateWTDocument" > <csvprimarycontenttype>ApplicationData</csvprimarycontenttype> <csvpath>DGadReq.doc</csvpath> <csvformat></csvformat> <csvcontdesc></csvcontdesc> <csvparentContainerPath></csvparentContainerPath></csvEndWTDocument></NmLoader>

Loading Documents that Are Soft Types of an Out-of-the-box Type

The following is an example of how to load documents that are soft-types of an out-of-the-box type.

This example assumes the following:

• A library called MyLib exists and contain a folder called Folder1.

• A soft-type of the out-of-the-box Reference Document, called SubOfRef, was created with two attributes:

a. MBool, a boolean

b. MString, a String

• An organization called MyOrg exists.

Given the above assumptions, the load can be performed using the following command:

windchill wt.load.LoadFromFile -d C:\Path\To\MyFile.xml -u wcadmin -p wcadmin -CONT_PATH \"/wt.inf.container.OrgContainer=MyOrg/wt.inf.library.WTLibrary=MyLib\"

6-12 Windchill Data Loading Reference and Best Practices Guide

Page 71: Wc Data Load Guide

Example

The following is an example data file:<?xml version="1.0" ?><!DOCTYPE NmLoader SYSTEM "standardX10.dtd"><NmLoader><csvBeginWTDocument handler="wt.doc.LoadDoc.beginCreateWTDocument" > <csvname>Name of SoftType Load - 01</csvname> <csvtitle>Title of SoftType Load - 01</csvtitle> <csvnumber>NUM:SoftType-01</csvnumber> <csvtype>Document</csvtype> <csvdescription>description 1112-002</csvdescription> <csvdepartment>DESIGN</csvdepartment> <csvsaveIn>/Default/Folder1</csvsaveIn> <csvteamTemplate></csvteamTemplate> <csvdomain></csvdomain> <csvlifecycletemplate></csvlifecycletemplate> <csvlifecyclestate></csvlifecyclestate> <csvtypedef>com.ptc.ReferenceDocument|com.ptc.SubOfRef</csvtypedef> <csvversion></csvversion> <csviteration></csviteration></csvBeginWTDocument>

<csvIBAValue handler="wt.iba.value.service.LoadValue.createIBAValue" > <csvdefinition>MyAttrs/MBool</csvdefinition> <csvvalue1>false</csvvalue1> <csvvalue2></csvvalue2> <csvdependency_id></csvdependency_id></csvIBAValue>

<csvIBAValue handler="wt.iba.value.service.LoadValue.createIBAValue" > <csvdefinition>MyAttrs/MString</csvdefinition> <csvvalue1>Eleven</csvvalue1> <csvvalue2></csvvalue2> <csvdependency_id></csvdependency_id></csvIBAValue></csvEndWTDocument></NmLoader>

In this example, the type definition for the Sub0Ref soft type includes both the complete soft type name (including the prefix of "com.ptc.", which helps define the type, in this case, com.ptc.Sub0Ref) and the parent soft type com.ptc.ReferenceDocument (which has the same prefix). For information on the prefix that is required when creating soft types, see the Windchill Business Administrator’s Guide.

Loading Product Objects and Parts: Windchill PDMLink Example 6-13

Page 72: Wc Data Load Guide

Loading Product Objects and PartsCreating product objects introduces the need to separate load files. Most likely, product objects and parts will be loaded into a product container. This product container belongs to an organization. When calling the load utility (wt.load.LoadFromFile) it is necessary to add the container path after the organization. For this reason, only objects to be loaded into the container path specified on the call to wt.load.LoadFromFile should be grouped together.

In this example, the same converted XML file from the call to CSV2XML is used as the starting point.

It is necessary to know the product names to be created. This information can be fed into a batch file that converts XML into the proper format and separates load files.

Preparing the Files

You can prepare the product object load files by doing the following:

1. Copy the products load file used as input for transform from "Product Containers".

2. Edit the input file (one copied above).

3. Search and replace the following:

<csvProduct, with <JProduct><csvProduct

4. Search and replace the following:

.endIBAHolder" /> with .endIBAHolder" /></JProduct>

5. Save the file.

6. Edit the main transform batch file to make sure it has the proper products.

7. Edit the secondary transform batch file to set the base names for input and output.

8. Execute the custom transforms.

9. Use the output files and load data into Windchill PDMLink.

Loading the Files

There are three steps required for loading the files.

Step 1Edit the output file of the CSV2XML conversion process used to create the product containers. Search and replace the beginning and ending tag as identified above. The result should look similar to the following example:

6-14 Windchill Data Loading Reference and Best Practices Guide

Page 73: Wc Data Load Guide

Example<?xml version="1.0"?><!DOCTYPE NmLoader SYSTEM "standardX10.dtd"><NmLoader>

<csvProductContainer handler="wt.part.LoadPart.createProductContainer"><csvuser>wcadmin</csvuser><csvname>PixProd002</csvname><csvsharedTeamName>Shared Team 2</csvsharedTeamName><csvcontainerExtendable>true</csvcontainerExtendable><csvnumber>PxPr002</csvnumber><csvdescription></csvdescription><csvview></csvview><csvsource>make</csvsource><csvdefaultUnit>ea</csvdefaultUnit><csvtype>separable</csvtype><csvcontainerTemplate>General Product</csvcontainerTemplate></csvProductContainer>

</NmLoader>

<csvsharedTeamName>Shared Team 2</csvsharedTeamName> and <csvcontainerExtendable>true</csvcontainerExtendable> are optional. Include these only when you want to include a shared team in your load data.

The addition of these tags is an important step in assisting in the XML transform needed to process this single file.

Step 2This example uses a custom developed XML transform. The following transform will accept as a Parameter and Product. The transform will filter the main Product.xml file looking for matches; when one is found, it is properly formatted and placed into an output file.

Example<?xml version="1.0"?><DOCTYPE NmLoader SYSTEM "standardX10.dtd">

<NmLoader>

<csvPart handler="wt.part.LoadPart.createPart"><csvuser></csvuser><csvpartName>LoadPart001</csvpartName><csvpartNumber>LP001,</csvpartNumber><csvtype>separable</csvtype><csvsource>make</csvsource><csvfolder>/Default/partloader</csvfolder><csvlifecycle>Default</csvlifecycle><csvview>Facility 1</csvview><csvteamTemplate></csvteamTemplate><csvlifecyclestate>INWORK</csvlifecyclestate><csvtypedef></csvtypedef><csvversion>A</csvversion><csviteration>9</csviteration><csvparentContainerPath></csvparentContainerPath><!--csvorganizationName>PTC,</csvorganizationName>

Loading Product Objects and Parts: Windchill PDMLink Example 6-15

Page 74: Wc Data Load Guide

<csvorganizationID>$$1234</csvorganizationID--></csvPart>

</NmLoader>

Tip: Add custom code to check and manipulate data values. The above transform converts from upper to lower case Part Type value.

Step 3The above transform should be processed once for each product than needs to be created. Creating two batch files can automate the execution of the transform. The first batch file (g.bat) is a control batch file with all the Products to be created.

Example@echo off

cls

call go.bat 123

call go.bat 456

call go.bat 967SA

The Second batch file (go.bat) executes the transform and produces output files.

@echo off

Cls

Echo.

Echo ------------------------------------------------------------------------

Echo Get Current Classpath and hold it

Echo ------------------------------------------------------------------------

Echo Classpath at start is: %CLASSPATH%

set _oldclspth=%CLASSPATH%

echo .

echo .

Echo ------------------------------------------------------------------------

Echo Variable Setup

Echo ------------------------------------------------------------------------

REM NORMALLY %1 would be used a parm variable, however, in the case that a parm

6-16 Windchill Data Loading Reference and Best Practices Guide

Page 75: Wc Data Load Guide

REM has a space like "Common Parts" the file thinks there are 2 parms %1 and %2 so:

REM %* will return all command line parameters following %0;

REM keep in mind that Windows NT 4 will insert an extra space before %*,

REM whereas 2000 and XP will remove all leading spaces from %*;

set _in=abc_prods.xml

set _out=toload\%*_data.xml

set _xsl=2products.xsl

echo Input file = %_in%

echo Output file = %_out%

echo XSL file = %_xsl%

echo .

echo .

Echo ------------------------------------------------------------------------

Echo Modify Current Classpath by adding Jars to Classpath

Echo ------------------------------------------------------------------------

set CLASSPATH=.;D:\xalan\bin;D:\xalan\bin\xalan.jar;D:\xalan\bin\xercesImpl.jar;D:\xalan\bin\xsltc.jar;%CLASSPATH%;

Echo Modified Classpath is now: %CLASSPATH%

echo .

echo .

Echo ------------------------------------------------------------------------

Echo Execute the Transform

Echo ------------------------------------------------------------------------

java UseStylesheetParam %_in% "%_out%" %_xsl% "%*"

echo .

echo .

Echo ------------------------------------------------------------------------

Loading Product Objects and Parts: Windchill PDMLink Example 6-17

Page 76: Wc Data Load Guide

Echo Return the Classpath back

Echo ------------------------------------------------------------------------

set CLASSPATH=%_oldclspth%

Echo Classpath at the end is: %CLASSPATH%

echo .

echo .

Tip: Use a Java Class to execute the transform. This allows the use of parameters. In this case, the parameter passed to the stylesheet is used to filter the output to just the objects that belong in the specified container path.

The data should now be ready for loading.

Batch FileFor objects that belong in product container, Prod_001, execute on one line the following command:

windchill wt.load.LoadFromFile -d prod_objs.xml -u wcoracle -p wcoracle -CONT_PATH \"/wt.inf.container.OrgContainer=My Organization/wt.pdmlink.PDMLinkProduct=Prod_001\"

Loading Parts with Specific Life Cycle and Team Templates

A part can be loaded into a library as a standalone part, or it can be loaded into a product.

The primary difference is the target objects specified in the -CONT_PATH argument. In the first example code, Loading with a Product Called MyProd in MyOrg, you are loading a part into a Product. In the second procedure, Loading with a Library Called MyLib in MyOrg, you are loading a part into a library. The same data file can be used to load a part into a product structure (End Item), or into a library.

When loading with a product, you would use wt.pdmlink.PDMLinkProduct (for example, \"/wt.inf.container.OrgContainer=MyOrg/wt.pdmlink.PDMLinkProduct=MyProd\")

When loading with a library, you would use wt.inf.library.WTLibrary (for example, \"/wt.inf.container.OrgContainer=MyOrg/wt.inf.library.WTLibrary=MyLib\")

You will load parts into a product container or a library container. Examples of the syntax are shown below.

Loading with a Product Called MyProd in MyOrgwindchill wt.load.LoadFromFile -d <Datafile> -CONT_PATH \"/wt.inf.container.OrgContainer=MyOrg/wt.pdmlink.PDMLinkProduct=MyProd\"

6-18 Windchill Data Loading Reference and Best Practices Guide

Page 77: Wc Data Load Guide

Loading with a Library Called MyLib in MyOrgwindchill wt.load.LoadFromFile -d <Datafile> -CONT_PATH \"/wt.inf.container.OrgContainer=MyOrg/wt.inf.library.WTLibrary=MyLib\"

About Escape CharactersThe backslash ("\") character denotes an escape character. Its usage in the -CONT_PATH argument follows this rule:

If the value(s) for /wt.inf.container.OrgContainer, /wt.pdmlink.PDMLinkProduct, or /wt.inf.library.WTLibrary contain spaces, then the entire argument should be enclosed in quotes ("").

However, due to quotes being special characters, they need to be escaped with a backslash. If there are no spaces in the organization, product, or library container name, then it is not necessary to provide the leading \" and trailing \". If there are spaces, then the leading \" and trailing \" are required and the loader will present errors if they are missing.

Loading Into a Specific Team Template and LifecycleIn the following example, TestTeamForLoads is the desired TeamTemplate and Basic is the desired Lifecycle for the part.

Example<?xml version="1.0"?><!DOCTYPE NmLoader SYSTEM "standardX10.dtd"><NmLoader><csvPart handler="wt.part.LoadPart.beginCreateWTPart"> <csvpartName>TestPart-01</csvpartName> <csvpartNumber>TestPart-01</csvpartNumber> <csvtype>separable</csvtype> <csvsource>make</csvsource> <csvfolder>/Default</csvfolder> <csvlifecycle>Basic</csvlifecycle> <csvview></csvview> <csvteamTemplate>System.TestTeamForLoads</csvteamTemplate> <csvlifecyclestate>INWORK</csvlifecyclestate> <csvtypedef></csvtypedef> <csvversion></csvversion> <csviteration></csviteration> <csvparentContainerPath></csvparentContainerPath></csvPart><csvEndWTPart handler="wt.part.LoadPart.endCreateWTPart" > <csvpublishFlag></csvpublishFlag> <csvparentContainerPath></csvparentContainerPath></csvEndWTPart></NmLoader>

Loading Product Objects and Parts: Windchill PDMLink Example 6-19

Page 78: Wc Data Load Guide

Tag Description

As shown in the examples above, the following tag is used to set the CreatedBy and Created values.

<csvPart>: Identifies the handler to be used to load and create parts in Windchill. This tag should always appear as follows:

<csvPart handler="wt.part.LoadPart.createPart">

Loading Relationships Between Parts and DocumentsThe describedBy link on a part links to a specific document iteration. The referencedBy link links to a document master (not a specific iteration of the document).

The <csvPartDocReference> tag creates the referencedBy link and the <csvPartDocDescribes> tag creates the describedBy link.

Example 1In this first example, we want to add document number DOC100 as a reference document on part PART100, version D, iteration 1, in the Manufacturing view.

The XML should resemble the following:

<?xml version="1.0"?><!DOCTYPE NmLoader SYSTEM "standardX10.dtd"><NmLoader><csvPartDocReference handler="wt.part.LoadPart.createPartDocReference"> <csvdocNumber>DOC100</csvdocNumber> <csvpartNumber>PART100</csvpartNumber> <csvpartVersion>D</csvpartVersion> <csvpartIteration>1</csvpartIteration> <csvpartView>Manufacturing</csvpartView></csvPartDocReference></NmLoader>

Example 2In this second example, we will add document number DOC100, version A, iteration 2 as a describing document for part number PART100, version D, iteration 1, in the Manufacturing view.

The XML should resemble the following:

<?xml version="1.0"?><!DOCTYPE NmLoader SYSTEM "standardX10.dtd"><NmLoader><csvPartDocDescribes handler="wt.part.LoadPart.createPartDocDescribes"> <csvdocNumber>DOC100</csvdocNumber> <csvdocVersion>A</csvdocVersion> <csvdocIteration>2</csvdocIteration> <csvpartNumber>PART100</csvpartNumber> <csvpartVersion>D</csvpartVersion> <csvpartIteration>1</csvpartIteration>

6-20 Windchill Data Loading Reference and Best Practices Guide

Page 79: Wc Data Load Guide

<csvpartView>Manufacturing</csvpartView></csvPartDocDescribes></NmLoader>

Tag Descriptions

As shown in the examples above, the following tags are used by both the <csvPartDocReference> and <csvPartDocDescribes> tags to create the referencedBy and describedBy links, respectively.

Below is a description of the tags and whether they have optional or required values.

• <csvdocNumber>: This tag is for the document number. A value is required.

• <csvdocVersion>: This is the document version. If no value is specified, the latest version is used.

• <csvdocIteration>: This is the document iteration. If no value is specified, the latest iteration is used.

• <csvpartNumber>: This is the part number. A value is required.

• <csvpartVersion>: This is the part version. If no value is specified, the latest version is used.

• <csvpartIteration>: This is the part iteration. If no value is specified, the latest iteration is used.

• <csvpartView>: This is the part's view. If no value is specified, the part not assigned a view is used.

Loading Product Objects and Parts: Windchill PDMLink Example 6-21

Page 80: Wc Data Load Guide

6-22 Windchill Data Loading Reference and Best Practices Guide

Page 81: Wc Data Load Guide

7Loading Documents:

Pro/INTRALINK 9.0 Example

This chapter provides a detailed example of the data loading process for documents in a Pro/INTRALINK 9.0 system.

For detailed information on Pro/INTRALINK, refer to Getting Started with Pro/INTRALINK 9.0. The most recent version of this guide is available from the Library page of your Pro/INTRALINK installation.

Section Page

Loading Documents in a Pro/INTRALINK 9.0 System .....................................7-2Sample Data File for Pro/INTRALINK ..............................................................7-2

7-1

Page 82: Wc Data Load Guide

Loading Documents in a Pro/INTRALINK 9.0 SystemIn Pro/INTRALINK 9.0, you use PDM capabilities to manage CAD documents and documents. Pro/INTRALINK supports loading of documents, but does not support loading of CAD documents via the LoadFromFile framework.

The process for loading documents to Pro/INTRALINK is the same as loading parts or CAD documents into another Windchill solution. Refer to The Data Loading Process earlier in this guide.

The load utility is prefixed by "windchill". An example command for loading documents would be:

windchill wt.load.LoadFromFile -d ProIDoc.xml -CONT_PATH "/wt.inf.container.OrgContainer=TST/wt.pdmlink.PDMLinkProduct=p art 4\"

Tip: Run the utility from the same directory where the data file resides.

Loading a LibraryThe command for loading a library to Pro/INTRALINK would resemble the following:

windchill wt.load.LoadFromFile -d OneDocSet.xml -CONT_PATH \"/wt.inf.container.OrgContainer=carrie/wt.inf.library.WTLibrary=VersionTest\"

Sample Data File for Pro/INTRALINKBelow is sample XML that could be loaded as a file into Pro/INTRALINK. Data files must be in XML format and must comply with the DTD supplied with the Windchill installation (available from the standardX10 directory). Refer to Validating the XML Format earlier in this guide for information on creating and validating XML data files.

Sample XML Code for Loading Documents<?xml version="1.0" ?><!DOCTYPE NmLoader SYSTEM "standardX10.dtd">

<NmLoader>

<csvBeginWTDocument handler="wt.doc.LoadDoc.beginCreateWTDocument" >

<csvname>A1002</csvname>

<csvtitle>title text</csvtitle>

<csvnumber>A1002</csvnumber>

<csvtype>Document</csvtype>

<csvdescription>description text</csvdescription>

<csvdepartment>DESIGN</csvdepartment>

7-2 Windchill Data Loading Reference and Best Practices Guide

Page 83: Wc Data Load Guide

<csvsaveIn>/Default/Folder 1</csvsaveIn>

<csvteamTemplate></csvteamTemplate>

<csvdomain></csvdomain>

<csvlifecycletemplate></csvlifecycletemplate>

<csvlifecyclestate></csvlifecyclestate>

<csvtypedef></csvtypedef>

<csvversion>A</csvversion>

<csviteration>1</csviteration>

</csvBeginWTDocument>

<csvEndWTDocument handler="wt.doc.LoadDoc.endCreateWTDocument" >

<csvprimarycontenttype>ApplicationData</csvprimarycontenttype>

<csvpath>DGadReq.doc</csvpath>

<csvformat></csvformat>

<csvcontdesc></csvcontdesc>

<csvparentContainerPath></csvparentContainerPath>

</csvEndWTDocument>

<csvBeginWTDocument handler="wt.doc.LoadDoc.beginCreateWTDocument" >

<csvname>A1003</csvname>

<csvtitle>title text</csvtitle>

<csvnumber>A1003</csvnumber>

<csvtype>Document</csvtype>

<csvdescription>description text</csvdescription>

<csvdepartment>DESIGN</csvdepartment>

<csvsaveIn>/Default</csvsaveIn>

<csvteamTemplate></csvteamTemplate>

<csvdomain></csvdomain>

<csvlifecycletemplate></csvlifecycletemplate>

<csvlifecyclestate></csvlifecyclestate>

<csvtypedef></csvtypedef>

<csvversion></csvversion>

<csviteration></csviteration>

Loading Documents: Pro/INTRALINK 9.0 Example 7-3

Page 84: Wc Data Load Guide

</csvBeginWTDocument>

<csvEndWTDocument handler="wt.doc.LoadDoc.endCreateWTDocument" >

<csvprimarycontenttype>ApplicationData</csvprimarycontenttype>

<csvpath>DGadReq.doc</csvpath>

<csvformat></csvformat>

<csvcontdesc></csvcontdesc>

<csvparentContainerPath></csvparentContainerPath>

</csvEndWTDocument>

</NmLoader>

7-4 Windchill Data Loading Reference and Best Practices Guide