Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
I am trying to enable autonumbering in a library context. Our entire site has autonumbering disabled as the result of some old customizations and a rehost. I've got an autonumbering rule that works within the context if the Site level OIR is disabled, but when both the Site and Context rules are enabled, I get an Oracle error as follows:
ORA-01400: cannot insert null into ("PDMLINKY4"."WTPARTMASTER"."WTPARTNUMBER")
I'm not much of a programmer and cutting and pasting tags is a pretty random approach for this kind of work, so I'm wondering if anyone has a rule they could share that would fit into the OIR scheme in such a way that it could be enabled at a context level and override a site level part numbering rule.
Thanks in advance.
Walter, Attached is the OOTB WTPart OIR with autonumbering enabled. You will want to pay particular attention to these sections:
<!-- set the number to a generated number -->
<AttrValue id="number" algorithm="com.ptc.windchill.enterprise.revisionControlled.server.impl.NumberGenerator">
<!-- add a V prefix for variant parts -->
<Value algorithm="wt.rule.algorithm.BooleanBranch">
<Value algorithm="wt.rule.algorithm.EqualsTest">
<Attr id="genericType"/>
<Arg>variant</Arg>
</Value>
<Arg>V</Arg>
<Arg></Arg>
</Value>
<!-- the sequence -->
<Arg>{GEN:wt.enterprise.SequenceGenerator:WTPARTID_seq:10:0}</Arg>
</AttrValue>
This specifies which Oracle sequence to use to determine the number value (WTPARTID_seq) along with how many characters it should be (10).
The below constraints section determines whether or not the number is editable in the wizards:
<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>
Wow, thanks Lori!
Excited to try this, hope it's easy enough for an engineer to do handle. It'll be a couple of days, but i'll let you know how it goes.
Walter