Администрирование предприятия > Загрузка данных Windchill > Loading Data for Product Families and Options and Variants > Loading Data From XML > Conditional Rule
  
Conditional Rule
Load the com.ptc.windchill.option.model.ConditionalRule object in Windchill database using the Windchill loader.
Table 12. Attributes for csvBeginConditionalRule
Attribute
Description
Required or Optional?
csvnumber
Rule name or number
Optional
csvversion
Version of the rule
Optional
csviteration
Iteration of the rule
Optional
csvdescription
Rule description
Optional
csvruleType
Rule type
Required
csvlocal
Specify whether the rule is local
Optional
csvoptionSet
Specify the option set for which the local rule was created
Optional
csvcontainerPath
Path to the context where the source choice resides
Optional
csvlifecycletemplate
Lifecycle template
Optional
csvlifecyclestate
Lifecycle state template
Optional
csvteamTemplate
Team template
Optional
csvmerged
Specify whether the rule is merged
Optional
Table 13. Attributes for BeginAssignExpression
Attribute
Description
Required or Optional?
csvexpression
Expression evaluated by the rule
Required
Table 14. Attributes for AddLogicalExpression
Attribute
Description
Required or Optional?
csvMemberNumber
Rule name or number
Optional
csvdescription
Rule description
Optional
csvexpression
Expression evaluated by the rule
Required
Table 15. Attributes for AddLogicalExpressionMember
Attribute
Description
Required or Optional?
csvmemberName
Choice name
Required
csvMemberNumber
Rule name or number
Optional
csvmemberClass
Choice class
Required
csvcontainerPath
Path to the choice’s context
Optional
Table 16. Attributes for AddRuleMember
Attribute
Description
Required or Optional?
csvmemberName
Choice name
Required
csvMemberNumber
Choice number
Optional
csvmemberClass
Choice class
Required
csvcontainerPath
Path to the choice’s context
Optional
csvruleMemberAction
Action executed by the rule
Required
Example
<!-- Conditional Rule -->
<csvBeginConditionalRule handler="com.ptc.windchill.option.load.Loader.beginConditionalRule">
<csvnumber>RED_APPLE</csvnumber>
<csvruleType>CONDITIONAL_RULE</csvruleType>
<csvcontainerPath/>
<csvmerged>true</csvmerged>
</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>
<csvdescription>Allow red and apple</csvdescription>
</csvAddLogicalExpression>

<csvAddLogicalExpressionMember handler="com.ptc.windchill.option.load.Loader.addLogicalExpressionMember">
<csvmemberName>AE_RED</csvmemberName>
<csvmemberNumber/>
<csvmemberClass>com.ptc.windchill.option.model.ChoiceMaster</csvmemberClass>
<csvcontainerPath>/wt.inf.container.OrgContainer=ATO Tests Organization/wt.pdmlink.PDMLinkProduct=ATOTests</csvcontainerPath>
<csvAddLogicalExpressionMember handler="com.ptc.windchill.option.load.Loader.addLogicalExpressionMember">
</csvAddLogicalExpressionMember>
<csvmemberName>AE_APPLE</csvmemberName>
<csvmemberNumber/>
<csvmemberClass>com.ptc.windchill.option.model.ChoiceMaster</csvmemberClass>
<csvcontainerPath>/wt.inf.container.OrgContainer=ATO Tests Organization/wt.pdmlink.PDMLinkProduct=ATOTests</csvcontainerPath>
</csvAddLogicalExpressionMember>

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

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

<!-- Add Rules from the ChoiceRule to the Choices -->
<csvAddRuleMember handler="com.ptc.windchill.option.load.Loader.addRuleMember">
<csvmemberName>AE_RED</csvmemberName>
<csvmemberClass>com.ptc.windchill.option.model.ChoiceMaster</csvmemberClass>
<csvcontainerPath>/wt.inf.container.OrgContainer=ATO Tests Organization/wt.pdmlink.PDMLinkProduct=ATOTests</csvcontainerPath>
<csvruleMemberAction>SELECT</csvruleMemberAction>
</csvAddRuleMember>
<csvAddRuleMember handler="com.ptc.windchill.option.load.Loader.addRuleMember">
<csvmemberName>AE_APPLE</csvmemberName>
<csvmemberClass>com.ptc.windchill.option.model.ChoiceMaster</csvmemberClass>
<csvcontainerPath>/wt.inf.container.OrgContainer=ATO Tests Organization/wt.pdmlink.PDMLinkProduct=ATOTests</csvcontainerPath>
<csvruleMemberAction>SELECT</csvruleMemberAction>
</csvAddRuleMember>

<csvEndConditionalRule handler="com.ptc.windchill.option.load.Loader.endConditionalRule"/>
Listing the Actions in the “Then” Section Individually
If a rule has several actions listed in the Then section, the rows with the same action can be combined or kept separate. For example, if you entered several rows selecting the Include action, these selections can be combined in one row under one Include action. The previous example shows the load file for the case when the rows are combined. To keep each action in a separate row, as it was entered, describe each row in the load file as follows (you can add a similar section for each additional row, as needed). Note that ACTION, CHOICE_A, and CHOICE_B must be replaced by the actual action name and choice names.
<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"/>