Skip to main content
13-Aquamarine
April 11, 2023
Solved

Enforcing structured name for WTDocument

  • April 11, 2023
  • 1 reply
  • 2996 views

Dear
We like to enforce a more structured naming convention for WTDocuments. For the moment the name is taken from the filename but we will not accept anything anymore in the future.
I like to work with Java code as a validaion list can be used there.
I understand that this must be part of the OIR, so the user will be prompted to give a proper name during the adding.
Can someone point me to the correct startpoint ?
Regards Bernard

 

Best answer by HelesicPetr

Hi @berny2U 

Oh first you need to define Windchill document attributes

in type and attribute management create global attribute and then add them to the WTDocument subtype as you need

For crated attributes crate the legal lists as you need or enumerated list 

example> INPUT1, INPUT2, INPUT3

 

Create WTDocument subtype OIR rules with correct definition

 

<AttrValue id="name" algorithm="com.ptc.windchill.enterprise.revisionControlled.server.impl.NumberGenerator">
 <Attr id="IBA|INPUT1"/>
 <Arg>_</Arg>
 <Attr id="IBA|INPUT2"/>
 <Arg>_</Arg>
 <Attr id="IBA|INPUT3"/>
</AttrValue>
		 
<AttrConstraint id="name" 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"/>
</AttrConstraint>	

 

 

Hope this can help

 

PetrH

 

1 reply

18-Opal
April 11, 2023

Bernard,

 

To be clear, you have a list of acceptable names that the user must use. Correct?

 

If yes, there are several ways to enforce this, but I would think the best would be a drop-down list that the user selects from. True?

 

Or do I misunderstand?

 

David

berny2U13-AquamarineAuthor
13-Aquamarine
April 11, 2023

David
I was thinking in terms of this : "Machine family name" + "_" +  "size" + "_" + V + "pcf version".  E.g. Phoenix_3015_V12

Whereby the machine name should come from a validation list.

So some degree of freedome should be needed via Java, a rollingbox would be too simple I guess.

Bernard

18-Opal
April 11, 2023

Bernard,


You can certainly write a custom algorithm to generate the value of any attribute (including Name) and then point your OIR to that custom code.

My questions would be:

Where is machine name coming from? The Product name?

Where is size coming from?

 

As for pcf Version, Name is stored in the master and is the same across all iterations of the object.

Can you really include version info in the name?

Or is the “name” you’re referring to a String attribute, not the Windchill name?

Or do I simply not understand? 🤷‍♂️