cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Enforcing structured name for WTDocument

berny2U
13-Aquamarine

Enforcing structured name for WTDocument

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

 

ACCEPTED SOLUTION

Accepted Solutions
HelesicPetr
22-Sapphire I
(To:berny2U)

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

 

View solution in original post

10 REPLIES 10

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

berny2U
13-Aquamarine
(To:d_graham)

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

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? 🤷‍♂️

 

 

berny2U
13-Aquamarine
(To:d_graham)

Hi David

The machine family type, size and version should be entered by the user and be validated against an internal list of valid names/sizes/formats. Historicly we have numbered the pcf versions for quick reference (despite of the revision (A,B,C,...) and the iteration), so I keep this not to confuse anyone. Ones a name has been chosen then it will be fixed like you mention for all the next versions/iterations.
Thanks for the help, I appreciate this.👍

Bernard

HelesicPetr
22-Sapphire I
(To:berny2U)

Hi @berny2U 

 

I would have a suggestion.

Set the name as autogenerated by server and add three attributes with legal or enumerated list .

User has to specify the attributes and OIR build the name based on the attributes. 

 

Easy 

Admin can change the legal/enumerated list anytime and you can set this behavior without coding. 

HelesicPetr_0-1681284203637.png

PetrH

berny2U
13-Aquamarine
(To:HelesicPetr)

Hello
Yes, indeed simple and easy, I like this.😉

berny2U
13-Aquamarine
(To:HelesicPetr)

Is there a getting started with this customization ?

HelesicPetr
22-Sapphire I
(To:berny2U)

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

 

berny2U
13-Aquamarine
(To:HelesicPetr)

Thanks PetrH !😊

HelesicPetr
22-Sapphire I
(To:berny2U)

@berny2U 

I have to to just add that you need to enable the autogeneration name for WTDocument

Follow the article > CS175686

 

PetrH

Announcements

Top Tags