Creating Product Containers
Currently, you can create a product container in one step. However, in this example, the customer had already prepared a load file for products based on an earlier Windchill load process.
For general administrative information about containers, see
Contexts Overview.
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:
<?xml version="1.0" ?><!DOCTYPE NmLoader SYSTEM "standardX20.dtd">
<NmLoader>
<csvProductContainer handler="wt.part.LoadPart.createProductContainer">
<csvuser>productcreator</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="standardX20.dtd"
/>
<xsl:template match="/">
<NmLoader>
<xsl:for-each select="//csvProduct">
<csvProductContainer handler="wt.part.LoadPart.createProduct
Container" >
<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"/></csv
description>
<csvview></csvview>
<csvsource></csvsource>
<csvdefaultUnit></csvdefaultUnit>
<csvtype></csvtype>
<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.
|
Although not illustrated in this example, XML code can be developed to test data and validate it. For example, if a value is empty but is 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:
windchill wt.load.LoadFromFile -d product_container.xml -u productcreator
-p productcreator -CONT_PATH \"/wt.inf.container.OrgContainer=My Organization\"
|
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 backslash.
|
|
To specify alternate default values, adjust the product (end item) initialization rules from the Site context within Windchill.
|