Loading Product Objects and Parts: Before You Begin
The examples in this section assume that the legacy data is being delivered in CSV format, and that it has been extracted and formatted as required by the loaders. XML and Java can be used to transform the data from the extracted format into the proper format to load into
Windchill (XML). For more information, see
Using the CSV2XML Utility and Validating the XML Format.
|
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. For a more detailed description of containers and how they must be organized, see Working with Containers.
|
When creating product, project, library, or program containers, use an account that has creator permission for that container, but do not use the default administrator account (for example, wcadmin). This guideline applies to the account you use to perform the operation and any XML elements that associate an account with the container, such as <csvcreator> or <csvuser>. Because the default administrator account is a member of so many container teams, the membership lookup for that account takes too long and causes the method server to start very slowly or time out. For the same reason, do not add the default administrator account as a team member of the container.
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 type shown in the Type and Attribute Management tool that is a parent to the type being specified, and <subtype1>, <subtype2>, and so on 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 and Attribute Management Internal Name field. To view the name for each type, open the Type and Attribute Management utility and then select the type in the panel on the left.
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>
The load utility is preceded by windchill.
For example:
windchill wt.load.LoadFromFile -d mydata.xml
|
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. The Windchill PDMLink Product is the container under the organization container. This is what is visible when viewing the Product tab in Windchill PDMLink. You must create a Windchill PDMLink product container.
In the following example, the XML code creates a product called LoadTest1. This product is visible when viewing the Organization tab. This example assumes that you have an organization called MyOrg.
1. To load the Windchill PDMLink Product Container called LoadTest1, create an XML file similar to the following example:
<?xml version="1.0"?>
<!DOCTYPE NmLoader SYSTEM "standardX20.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:
|
You must run this command as a user who belongs to the Site Administrator group.
|
D:\10.0\Windchill>windchill wt.load.LoadFromFile -d d:\10.0\Windchill\
loadFiles\ProductContainerLoad.xml
-CONT_PATH \"/wt.inf.container.OrgContainer=MyOrg\"
The product called TestLoad1 is now visible in the Product context.