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

How do you set a Document's Name in an OIR?

How do you set a Document's Name in an OIR?

I would like to set the Document's name to the value of an attribute plus a suffix. Anybody have an example I can follow?

thx!

6 REPLIES 6
Highlighted

Re: How do you set a Document's Name in an OIR?

Re: How do you set a Document's Name in an OIR?

That allows me now to specify the rule and upload the OIR, but when I try to create a document, if I leave the name field blank, it specifies that it is a required field. If i give it a value, that is the value that appears after the document is created.

This is what I have added per the article

<AttrValue

    id="name"

    algorithm="com.ptc.windchill.enterprise.revisionControlled.server.impl.NumberGenerator"

    ignore="false"

    force="false"

    final="false">

    <Attr id="IBA|IBA_NAME"/>

    <Arg> - SOME VALUE</Arg>

  </AttrValue>

  <AttrConstraint

    id="name"

    algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints"

    ignore="false"

    force="false"

    final="false">

    <Value algorithm="com.ptc.core.rule.server.impl.GetServerAssignedConstraint">

    </Value>

  </AttrConstraint>

Re: How do you set a Document's Name in an OIR?

I remember seeing something on this and I think you need to make the OIR "aware" of the IBA(s) that you are using with VarDef and then using the value with VarRef.  Look in the Help Center under Syntax for Algorithm Arguments.

I have not used myself, so can not help you much beyond that.  I was trying to use "temporary" values rather than IBA's and never figured out how.

Re: How do you set a Document's Name in an OIR?

I'm struggling with the same issue...

When using the code for the Number field, it works fine.  But it doesn't work for the Name field.

<AttrValue id="name" algorithm="com.ptc.windchill.enterprise.revisionControlled.server.impl.NumberGenerator">

    <Attr id="IBA|IBA_NAME1"/>

           <Arg>_</Arg>

    <Attr id="IBA|IBA_NAME2"/>

</AttrValue>

<AttrConstraint id="name" algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">

    <Value algorithm="com.ptc.core.rule.server.impl.GetServerAssignedConstraint"/>

</AttrConstraint>

For another document type I added following code in OIR:

<!-- set the prefix of the name -->

<AttrValue id="name" algorithm="com.ptc.windchill.enterprise.revisionControlled.server.impl.NumberGenerator">

    <Arg>ENG - </Arg>

</AttrValue>

<AttrConstraint id="name" algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">

    <Value algorithm="com.ptc.core.rule.server.impl.GetServerPreGeneratedValue"/>

    <Value algorithm="com.ptc.core.rule.server.impl.GetImmutableConstraint"/>

</AttrConstraint>

which results in the following:

Capture.JPG

PS You should remove <Arg> - SOME VALUE</Arg>.  This will only add "- SOME VALUE" in the Name field.

Re: How do you set a Document's Name in an OIR?

Solution found: add     <Value algorithm="com.ptc.core.rule.server.impl.GetHiddenConstraint"/>

<AttrConstraint id="name" algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">

    <Value algorithm="com.ptc.core.rule.server.impl.GetServerPreGeneratedValue"/>

   <Value algorithm="com.ptc.core.rule.server.impl.GetHiddenConstraint"/>

</AttrConstraint>

Re: How do you set a Document's Name in an OIR?

Stephen,

Were you ever able to get this to work? I can't get past the name being required, so it doesn't for me. Plus, I'm trying this for a WtPart.