Option Set
Load the com.ptc.windchill.option.model.OptionSet object and the option set subtype in the Windchill database using Windchill loader.
XML Format
<csvBeginOptionSet handler="com.ptc.windchill.option.load.Loader.beginCreateOptionSet" >
<csvname>option set name</csvname>
<csvtypedef>option set type to be created</csvtypedef>
<csvdescription>description of option set</csvdescription>
<csvsupportExclusionOptionChoices>option set choice for exclusion true/false
</csvsupportExclusionOptionChoices>
<csvsupportItemOptionChoices>support choice association on items from
this option set true/false
</csvsupportItemOptionChoices>
<csvreferenceOptionPoolRulesAutomatically>automatically reference rules from pool to
this option set true/false
</csvsupportItemOptionChoices>
<csvmerged>true</csvmerged>
</csvBeginOptionSet>
<csvAddChoice handler="com.ptc.windchill.option.load.Loader.addChoice" >
<csvname>choice name</csvname>
<csvcontainerPath>container of choice to search for choice to be added
</csvcontainerPath>
</csvAddChoice>
...
...
<csvEndOptionSet handler= "com.ptc.windchill.option.load.Loader.endCreateOptionSet" />
Table 17. Attributes for csvBeginOptionSet
Attribute
Description
Required or Optional?
csvname
Option set name
Required
csvtypedef
Windchill object type
Optional
csvdescription
Option set description
Optional
csvsupportExclusionOptionChoices
Specifies whether the option set supports exclude choices
Optional
csvsupportItemOptionChoices
Controls the assignment of choices to a product structure. If the value of this attribute is set to No, users can assign choices to configurable modules and to their usage links. If it is set to Yes, users may assign choices to standard (i.e., non-configurable) parts as well. By default, this attribute is set to No.
Optional
csvsupportEffectivityOnOptionChoices
Specifies whether the option set supports effectivity for choices
Optional
csvreferenceOptionPoolRulesAutomatically
Specifies whether global rules should be inherited by the option set
Optional
csvmerged
Specify whether the option set is merged
Optional
Example
<csvBeginOptionSet handler="com.ptc.windchill.option.load.Loader.beginCreateOptionSet">
<csvname>Colour Pallet</csvname>
<csvdescription>Colour Pallet To Select Color</csvdescription>
<csvsupportExclusionOptionChoices>true</csvsupportExclusionOptionChoices>
<csvsupportItemOptionChoices>true</csvsupportItemOptionChoices>
<csvsupportEffectivityOnOptionChoices>true</csvsupportEffectivityOnOptionChoices>
<csvreferenceOptionPoolRulesAutomatically>true
</csvreferenceOptionPoolRulesAutomatically>
<csvmerged>true</csvmerged>

</csvBeginOptionSet>
<csvAddChoice handler="com.ptc.windchill.option.load.Loader.addChoice">
<csvname>Red</csvname>
<csvcontainerPath />
<csvmerged>true</csvmerged>
</csvAddChoice>
<csvAddChoice handler="com.ptc.windchill.option.load.Loader.addChoice">
<csvname>Green</csvname>
<csvcontainerPath />
</csvAddChoice>
<csvAddChoice handler="com.ptc.windchill.option.load.Loader.addChoice">
<csvname>Blue</csvname>
<csvcontainerPath />
</csvAddChoice>
<csvAddChoice handler="com.ptc.windchill.option.load.Loader.addChoice">
<csvname>Glossy</csvname>
<csvcontainerPath />
</csvAddChoice>
<csvAddChoice handler="com.ptc.windchill.option.load.Loader.addChoice">
<csvname>Matte</csvname>
<csvcontainerPath />
</csvAddChoice>
<csvEndOptionSet handler="com.ptc.windchill.option.load.Loader.endCreateOptionSet" />
Load Method for Local Include, Exclude, Enable, and Conditional Rules
You can load the local Include, Exclude, Enable, and Conditional Rules using the optional csvoptionSet attribute available on the respective load method for each type. These methods can be optionally included in the following Option Set methods to load one or more local rules to a single version of the Option Set.
Table 18. Optional Methods for Loading Local Rules
The following table describes the optional Option Set methods for loading local rules.
Method
Description
Required or Optional?
csvBeginChoiceRules
Defines the beginning of local rules to be loaded to a single Option Set version. The Option Set is checked out.
Optional
csvEndChoiceRules
Defines the end of local rules to be loaded to a single Option Set version and must have a preceding csvBeginChoiceRules. The Option Set is checked in.
When csvBeginChoiceRules is used without a csvEndChoiceRules, the Option Set remains checked out.
Optional
Example
<csvBeginChoiceRules handler="com.ptc.windchill.option.load.Loader.beginChoiceRules"/>

<!-- Conditional Rule -->
<csvBeginConditionalRule handler="com.ptc.windchill.option.load.Loader.beginConditionalRule">
<csvnumber>RED_APPLE</csvnumber>
<csvruleType>CONDITIONAL_RULE</csvruleType>
<csvlocal>true</csvlocal>
<csvoptionSet>Colour Pallet</csvoptionSet>
<csvcontainerPath/>
</csvBeginConditionalRule>

<csvBeginAssignExpression handler="com.ptc.windchill.option.load.Loader.beginAssignExpression">
<csvexpression>EXP0</csvexpression>
</csvBeginAssignExpression>

<csvAddLogicalExpression handler="com.ptc.windchill.option.load.Loader.addLogicalExpression">
<csvnumber>EXP0</csvnumber>
<csvexpression>AE_RED AND AE_APPLE</csvexpression>
</csvAddLogicalExpression>

<csvAddLogicalExpressionMember handler="com.ptc.windchill.option.load.Loader.addLogicalExpressionMember">
<csvmemberName>AE_RED</csvmemberName>
<csvmemberNumber/>
<csvmemberClass>com.ptc.windchill.option.model.ChoiceMaster</csvmemberClass>
</csvAddLogicalExpressionMember>

<csvEndLogicalExpression handler="com.ptc.windchill.option.load.Loader.endLogicalExpression"/>

<csvEndAssignExpression handler="com.ptc.windchill.option.load.Loader.endAssignExpression"/>

<csvBeginRuleMemberAction handler="com.ptc.windchill.option.load.Loader.beginRuleMemberAction">
<csvruleMemberAction>ACTION</csvruleMemberAction>
</csvBeginRuleMemberAction>
<csvAddRuleActionMember handler="com.ptc.windchill.option.load.Loader.addRuleActionMember">
<csvmemberName>CHOICE_A</csvmemberName>
<csvmemberClass>com.ptc.windchill.option.model.ChoiceMaster</csvmemberClass>
<csvcontainerPath/>
</csvAddRuleActionMember>

<csvAddRuleActionMember handler="com.ptc.windchill.option.load.Loader.addRuleActionMember">
<csvmemberName>CHOICE_B</csvmemberName>
<csvmemberClass>com.ptc.windchill.option.model.ChoiceMaster</csvmemberClass>
<csvcontainerPath/>
</csvAddRuleActionMember>

<csvEndRuleMemberAction handler="com.ptc.windchill.option.load.Loader.endRuleMemberAction"/>
<csvEndConditionalRule handler="com.ptc.windchill.option.load.Loader.endConditionalRule"/>

<!-- Include Rule -->
<csvBeginChoiceMapping handler="com.ptc.windchill.option.load.Loader.beginChoiceMapping">
<csvsourceChoiceName>Red</csvsourceChoiceName>
<csvnumber>IR-00001</csvnumber>
<csvdescription/>
<csvlocal>true</csvlocal>
<csvoptionSet>Colour Pallet</csvoptionSet>
</csvBeginChoiceMapping>
<csvChoiceMappingTargetChoice handler="com.ptc.windchill.option.load.Loader.createChoiceMappingTargetChoice">
<csvtargetChoiceName>Glossy</csvtargetChoiceName>
<csvcontainerPath/>
</csvChoiceMappingTargetChoice>
<csvEndChoiceMapping handler="com.ptc.windchill.option.load.Loader.endChoiceMapping"/>

<!-- Exclude Rule -->
<csvBeginChoiceConstraint handler="com.ptc.windchill.option.load.Loader.beginChoiceConstraint">
<csvnumber>ER-00001</csvnumber>
<csvdescription/>
<csvlocal>true</csvlocal>
<csvoptionSet>Colour Pallet</csvoptionSet>
</csvBeginChoiceConstraint>
<csvConstraintChoice handler="com.ptc.windchill.option.load.Loader.constraintChoice">
<csvname>Red</csvname>
</csvConstraintChoice>

<csvConstraintChoice handler="com.ptc.windchill.option.load.Loader.constraintChoice">
<csvname>Glossy</csvname>
</csvConstraintChoice>
<csvEndChoiceConstraint handler="com.ptc.windchill.option.load.Loader.endChoiceConstraint"/>

<!-- Enable Rule -->
<csvBeginChoiceEnable handler="com.ptc.windchill.option.load.Loader.beginChoiceEnable">
<csvsourceChoiceName>D0001</csvsourceChoiceName>
<csvnumber>ENR-00001</csvnumber>
<csvdescription/>
<csvlocal>true</csvlocal>
<csvoptionSet>Colour Pallet</csvoptionSet>
</csvBeginChoiceEnable>

<csvChoiceEnableTargetChoice handler="com.ptc.windchill.option.load.Loader.createChoiceEnableTargetChoice">
<csvtargetChoiceName>D0026</csvtargetChoiceName>
<csvcontainerPath/>
</csvChoiceEnableTargetChoice>
<csvEndChoiceEnable handler="com.ptc.windchill.option.load.Loader.endChoiceEnable"/>

<csvEndChoiceRules handler="com.ptc.windchill.option.load.Loader.endChoiceRules"/>
這是否有幫助?