Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hello,
I have a below requirement, request you to shed some light on how the same can be achieved.
i) There are two IBAs loaded at WTPart level, let's say IBA1 and IBA2.
ii) If a specific value is selected for IBA1, IBA2 must be populated with an auto generated number similar to what we do for WTPart number generation.
I want to know the feasibility to achieve the above requirement by modifying the OIR of the part, since it would require less customization as compared to developing a data utility.
Thanks,
Hari
Hello,
No, it does not have a defined list of values but I want to generate a number for the IBA based on a DB sequence.
Hi,
I dont think so it will be possible from OIR.
Instead of datautility, We can implement a JS function in part.jsp.
Hi @Sha11
Try to check an OIR of WTPart type there is a EndItem check to turn off an autonumbering.
it is nice example how to achieve what you need.
Concert to the AttrConstraint element with number
For end items in PDMLink context, turn the autonumbering off -->
<AttrConstraint id="number" algorithm="wt.rule.algorithm.BooleanBranch">
<Value algorithm="com.ptc.core.rule.server.impl.IfContainerTypeEqualsProjectTest"/>
<Value algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">
<Value algorithm="com.ptc.core.rule.server.impl.GetServerAssignedConstraint"/>
</Value>
<Value algorithm="wt.rule.algorithm.BooleanBranch">
<Value algorithm="wt.rule.algorithm.StringEqualsTest">
<Attr id="endItem"/>
<Arg>true</Arg>
</Value>
<Value algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints"/>
<Value algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">
<Value algorithm="com.ptc.core.rule.server.impl.GetServerAssignedConstraint"/>
<Value algorithm="com.ptc.core.rule.server.impl.GetImmutableConstraint"/>
</Value>
</Value>
</AttrConstraint>
You need to add your check with your IBA1
it could looks like (I remove the EndItem check):
For end items in PDMLink context, turn the autonumbering off -->
<AttrConstraint id="IBA2" algorithm="wt.rule.algorithm.BooleanBranch">
<Value algorithm="com.ptc.core.rule.server.impl.IfContainerTypeEqualsProjectTest"/>
<Value algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">
<Value algorithm="com.ptc.core.rule.server.impl.GetServerAssignedConstraint"/>
</Value>
<Value algorithm="wt.rule.algorithm.BooleanBranch">
<Value algorithm="wt.rule.algorithm.StringEqualsTest">
<Attr id="IBA1"/>
<Arg>yourStringValue</Arg>
</Value>
<Value algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">
<Value algorithm="com.ptc.core.rule.server.impl.GetServerAssignedConstraint"/>
<Value algorithm="com.ptc.core.rule.server.impl.GetImmutableConstraint"/>
</Value>
<Value algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints"/>
</Value>
</AttrConstraint>
try it if it works.
If not, you can not achieve what you need by OIR.
PetrH