Hi All,
I thought I'd share this for those looking to do the same thing.
We had a requirement to set one of our attributes equal to another attribute in the same object. In our case, we wanted an attribute called "EP_NUMBER" to be equal to the "Number" field that is auto-generated by Windchill.
This was easily accomplished (once we knew where to find this information) using OIRs for our object. Below is the syntax that we added to the OIR XML file for our object:
<attrvalue id="EP_NUMBER"> <attr id="number"/"></attrvalue>
You only need to change the terms "EP_NUMBER" and "number" to be your attribute names. It uses the logical identifier of the attribute.
A few things to point out about this:* You cannot have a default value for the attribute you are setting. Windchill sees the default value and assumes that it should not be overwritten. We didn't have a default value set in our object type but we had a template setup that used this object and in that template, there was a default value set for EP_NUMBER. So this caused us a bit of grief trying to find out why the value was not being automatically set to "number."* You can hide your attribute (EP_NUMBER) during creation and update operations using the constraints in the Types and Attribute Manager. The attribute will still be set correctly even though the user never sees the attribute until it's shown in the information page for the object.* The rule sets the attribute AFTER selecting FINISH to complete the creation of the object. The attribute will not be updated until after creation. This was not an issue for us but it may be for you depending on your requirements.
The syntax was found in buried in the online help for OIRs. Like most things in Windchill, it's easy to do and takes five minutes to implement.....after you've spent 16 hours trying to find the solution 🙂
Mike -