Option and Choices
Load the com.ptc.windchill.option.model.Option object with the option subtypes and the associated choices in the Windchill database using the Windchill loader.
This method allows you to load all choices that are associated with a given option as part of the option loading process. As the option is loaded, the system creates the first iteration of the option (for example, as A.1) and checks it out. The sequence in which the choices are specified in the load file is the default order in which they are displayed in the system. When, for example, a load file defines Choice A2 for Option A, Choice B1 for Option B, and Choice A1 for Option A, the default order of the options is Option A followed by Option B, where the choices for Option A are ordered as Choice A2 followed by Choice A1. Once all associated choices are loaded, the option is checked in (for example, as A.2).
|
For proper loading of options and choices, make sure all open tags have the corresponding closing tags.
|
XML Format for Loading an Option with its Associated Choices
<csvBeginOption handler="com.ptc.windchill.option.load.Loader.beginOption" >
<csvtypedef>option type to be created</csvtypedef>
<csvname>option name</csvname>
<csvdescription>description</csvdescription>
<csvoptionDataType>option data type STRING/NUMERIC/BOOLEAN</csvoptionDataType> <!--Optional if using STRING-->
<csvQoMName>QoM name</csvQoMName> <!-- Only needed with NUMERIC options (required) -->
<csvoptionGroup>option group</csvoptionGroup>
<csvsingleChoiceSelection>select single choice true/false</csvsingleChoiceSelection><!--must be "true" for BOOLEAN options-->
<csvrequiredOption>require selection for option true/false</csvrequiredOption>
</csvBeginOption >
<csvBeginChoice handler="com.ptc.windchill.option.load.Loader.beginChoice">
. . .
</csvBeginChoice>
<csvEndChoice handler="com.ptc.windchill.option.load.Loader.endChoice"/>
... n choices
<csvEndOption handler= "com.ptc.windchill.option.load.Loader.endOption" />
Table 2. Attributes for csvBeginOption
Attribute
|
Description
|
Required or Optional?
|
csvtypedef
|
Windchill object type.
|
Required
|
csvname
|
Option name.
|
Required
|
csvnumber
|
Option number.
|
Optional
|
csvdescription
|
Description for the option.
|
Optional
|
csvoptionGroup
|
Name of the group to which the option belongs.
|
Optional
|
csvrequiredOption
|
Specifies whether the option is Required.
|
Optional
|
csvoptionDataType
|
Specifies the type of choices the option has. Valid types are STRING, NUMERIC, and BOOLEAN.
|
Optional
|
csvsingleChoiceSelection
|
Specifies whether the option is a single-selection option. For boolean option, this must be set to “true”.
|
Optional
|
csvautoCreateBooleanChoices
|
Specifies whether to automatically create boolean choices for boolean options. By default, this is set to "true" and any specified boolean choices cause the load to fail. Setting this to "false" allows you to specify boolean choices and their attributes.
|
Optional
|
csvQoMName
|
Specifies the Quantity of Measure for an option with numeric values.
|
Optional
|
csvOverrideDisplayUnits
|
Use this field to set override units for the specified measurement system in the format SI:mm;MKS:cm.
|
Optional
|
Table 3. Attributes for csvBeginChoice
Attribute
|
Description
|
Required or Optional?
|
csvname
|
Choice name
|
Required
|
csvnumber
|
Choice number
|
Optional
|
csvdescription
|
Choice description
|
Optional
|
csvoption
|
Option name for which the choice was defined
|
Optional
|
csvoptionNumber
|
Option number for which the choice was defined
|
Optional
|
csvtypedef
|
Windchill object type
|
Required
|
csvchoiceDataValue
|
Specifies the value for a numeric choice
|
Optional
|
|
While both csvoption and csvoptionNumber are optional attributes, you must specify at least one of them.
|
Example:
<csvBeginOption handler="com.ptc.windchill.option.load.Loader.beginOption">
<csvtypedef>com.ptc.windchill.option.SalesOption</csvtypedef>
<csvname>Colours</csvname>
<csvoptionGroup>Colour configuration</csvoptionGroup>
<csvsingleChoiceSelection>false</csvsingleChoiceSelection>
</csvBeginOption>
<csvBeginChoice handler="com.ptc.windchill.option.load.Loader.beginChoice">
<csvname>Red</csvname>
<csvdescription>Red</csvdescription>
<csvoption>Colors</csvoption>
<csvtypedef>com.ptc.windchill.option.SalesChoice</csvtypedef>
</csvBeginChoice>
<csvEndChoice handler="com.ptc.windchill.option.load.Loader.endChoice"/>
<csvBeginChoice handler="com.ptc.windchill.option.load.Loader.beginChoice">
<csvname>Green</csvname>
<csvdescription>Green</csvdescription>
<csvoption>Colors</csvoption>
<csvtypedef>com.ptc.windchill.option.SalesChoice</csvtypedef>
</csvBeginChoice>
<csvEndChoice handler="com.ptc.windchill.option.load.Loader.endChoice"/>
<csvBeginChoice handler"com.ptc.windchill.option.load.Loader.beginChoice"=>
<csvname>Blue</csvname>
<csvdescription>Blue</csvdescription>\
<csvoption>Colors</csvoption>
<csvtypedef>com.ptc.windchill.option.SalesChoice</csvtypedef>
</csvBeginChoice>
<csvEndChoice handler="com.ptc.windchill.option.load.Loader.endChoice"/>
<csvBeginChoice handler="com.ptc.windchill.option.load.Loader.beginChoice">
<csvname>Glossy</csvname>
<csvdescription>Glossy</csvdescription>
<csvoption>Finishing</csvoption>
<csvtypedef>com.ptc.windchill.option.SalesChoice</csvtypedef>
</csvBeginChoice>
<csvEndChoice handler=/"com.ptc.windchill.option.load.Loader.endChoice">
<csvBeginChoice handler=>"com.ptc.windchill.option.load.Loader.beginChoice"
<csvname>Matt</csvname>\
<csvdescription>Matt</csvdescription>
<csvoption>Finishing</csvoption>
<csvtypedef>com.ptc.windchill.option.SalesChoice</csvtypedef>
</csvBeginChoice>
<csvEndChoice handler="com.ptc.windchill.option.load.Loader.endChoice"/>
<csvBeginOption handler="com.ptc.windchill.option.load.Loader.beginOption">
<csvtypedef>com.ptc.windchill.option.SalesOption</csvtypedef>
<csvname>Finishing</csvname>
<csvoptionGroup>Colour configuration</csvoptionGroup>
<csvsingleChoiceSelection>false</csvsingleChoiceSelection>
< csvrequiredChoiceSelection>true</ csvrequiredChoiceSelection>
<csvEndOption handler="com.ptc.windchill.option.load.Loader.endOption"/>
Example of a Loading a Numeric Option
<csvBeginOption handler="com.ptc.windchill.option.load.Loader.beginOption">
<csvtypedef>com.ptc.windchill.option.DesignOption</csvtypedef>
<csvname>OCTD_LENGTH</csvname>
<csvoptionDataType>NUMERIC</csvoptionDataType>
<csvQoMName>Length</csvQoMName>
<csvOverrideDisplayUnits>SI:cm;MKS:mm</csvOverrideDisplayUnits>
<csvoptionGroup></csvoptionGroup>
<csvsingleChoiceSelection>True</csvsingleChoiceSelection>
</csvBeginOption>
Example of Loading A Numeric Choice
|
The choice inherits its choice data type from its option.
|
<csvBeginChoice handler="com.ptc.windchill.option.load.Loader.beginChoice">
<csvname>OCTD_10M</csvname>
<csvdescription>OCTD_10M</csvdescription>
<csvchoiceDataValue>10</csvchoiceDataValue>
<csvoption>OCTD_LENGTH</csvoption>
<csvtypedef>com.ptc.windchill.option.DesignChoice</csvtypedef>
</csvBeginChoice>
<csvEndChoice handler="com.ptc.windchill.option.load.Loader.endChoice"/>
Example of Loading String Options and Choices
<!-- Option Group: Color configuration -->
<csvOptionGroup handler="com.ptc.windchill.option.load.Loader.createGroup">
<csvname>Color configuration</csvname>
<csvoptionTypeDef>com.ptc.windchill.option.DesignOption</csvoptionTypeDef>
</csvOptionGroup>
<!-- Design Option: Color -->
<csvBeginOption handler="com.ptc.windchill.option.load.Loader.beginOption">
<csvtypedef>com.ptc.windchill.option.DesignOption</csvtypedef>
<csvname>Colors</csvname>
<csvoptionGroup>Color Configuration</csvoptionGroup>
<csvsingleChoiceSelection>false</csvsingleChoiceSelection>
</csvBeginOption>
<!-- Design Choices: Red, Green, Blue -->
<csvBeginChoice handler="com.ptc.windchill.option.load.Loader.beginChoice">
<csvname>Red</csvname>
<csvdescription>Red</csvdescription>
<csvoption>Colors</csvoption>
<csvtypedef>com.ptc.windchill.option.DesignChoice</csvtypedef>
</csvBeginChoice>
<csvEndChoice handler="com.ptc.windchill.option.load.Loader.endChoice"/>
<csvBeginChoice handler="com.ptc.windchill.option.load.Loader.beginChoice">
<csvname>Green</csvname>
<csvdescription>Green</csvdescription>
<csvoption>Colors</csvoption>
<csvtypedef>com.ptc.windchill.option.DesignChoice</csvtypedef>
</csvBeginChoice>
<csvEndChoice handler="com.ptc.windchill.option.load.Loader.endChoice"/>
<csvBeginChoice handler="com.ptc.windchill.option.load.Loader.beginChoice">
<csvname>Blue</csvname>
<csvdescription>Blue</csvdescription>
<csvoption>Colors</csvoption>
<csvtypedef>com.ptc.windchill.option.DesignChoice</csvtypedef>
</csvBeginChoice>
<csvEndChoice handler="com.ptc.windchill.option.load.Loader.endChoice"/>
csvEndOption handler="com.ptc.windchill.option.load.Loader.endOption"/>
<!-- Design Option: Finishing -->
<csvBeginOption handler="com.ptc.windchill.option.load.Loader.beginOption">
<csvtypedef>com.ptc.windchill.option.DesignOption</csvtypedef>
<csvname>Finishing</csvname>
<csvoptionGroup>Color configuration</csvoptionGroup>
<csvrequiredOption>true</csvrequiredOption>
<csvsingleChoiceSelection>true</csvsingleChoiceSelection>
</csvBeginOption>
<!-- Design Choices: Glossy, Matte -->
<csvBeginChoice handler="com.ptc.windchill.option.load.Loader.beginChoice">
<csvname>Glossy</csvname>
<csvdescription>Glossy</csvdescription>
<csvoption>Finishing</csvoption>
<csvtypedef>com.ptc.windchill.option.DesignChoice</csvtypedef>
</csvBeginChoice>
<csvEndChoice handler="com.ptc.windchill.option.load.Loader.endChoice"/>
<csvBeginChoice handler="com.ptc.windchill.option.load.Loader.beginChoice">
<csvname>Matte</csvname>
<csvdescription>Matte</csvdescription>
<csvoption>Finishing</csvoption>
<csvtypedef>com.ptc.windchill.option.DesignChoice</csvtypedef>
</csvBeginChoice>
<csvEndChoice handler="com.ptc.windchill.option.load.Loader.endChoice"/>
<csvEndOption handler="com.ptc.windchill.option.load.Loader.endOption"/>
Example of Loading Boolean Option and Choices
|
When not auto creating boolean choices (csvautoCreateBooleanChoices = false), two choices must be specified in the load file to represent True and False. The name of the choices (csvname) must contain the name of the option appended by _TRUE and _FALSE. For example, <OptionName>_TRUE and <OptionName>_FALSE, as specified in the following example.
|
<csvBeginOption handler="com.ptc.windchill.option.load.Loader.beginOption">
<csvtypedef>com.ptc.windchill.option.DesignOption</csvtypedef>
<csvname>IsDeluxeTrim</csvname>
<csvoptionDataType>BOOLEAN</csvoptionDataType>
<csvoptionGroup></csvoptionGroup>
<csvsingleChoiceSelection>true</csvsingleChoiceSelection>
<csvautoCreateBooleanChoices>false</csvautoCreateBooleanChoices>
</csvBeginOption>
<csvEndOption handler="com.ptc.windchill.option.load.Loader.endOption"/>
<csvBeginChoice handler="com.ptc.windchill.option.load.Loader.beginChoice">
<csvname>IsDeluxeTrim_TRUE</csvname>
<csvdescription>The trim is deluxe</csvdescription>
<csvoption>TestLoadBooleanChoices</csvoption>
<csvtypedef>com.ptc.windchill.option.DesignChoice</csvtypedef>
<csvnumber>IsDeluxeTrim_TRUE</csvnumber>
</csvBeginChoice>
<csvEndChoice handler="com.ptc.windchill.option.load.Loader.endChoice"/>
<csvBeginChoice handler="com.ptc.windchill.option.load.Loader.beginChoice">
<csvname>IsDeluxeTrim_FALSE</csvname>
<csvdescription>The trim is not deluxe</csvdescription>
<csvoption>TestLoadBooleanChoices</csvoption>
<csvtypedef>com.ptc.windchill.option.DesignChoice</csvtypedef>
<csvnumber>IsDeluxeTrim_FALSE</csvnumber>
</csvBeginChoice>
<csvEndChoice handler="com.ptc.windchill.option.load.Loader.endChoice">