Skip to main content
14-Alexandrite
October 12, 2022
Question

OIR Update for IBA Value

  • October 12, 2022
  • 2 replies
  • 1558 views

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

2 replies

11-Garnet
October 18, 2022

HI @Sha11 ,

Does IBA2 have list of values?

Sha1114-AlexandriteAuthor
14-Alexandrite
October 18, 2022

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.

11-Garnet
November 2, 2022

Hi,

 

I dont think so it will be possible from OIR.

Instead of datautility, We can implement a JS function in part.jsp.

HelesicPetr
22-Sapphire II
22-Sapphire II
November 2, 2022

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