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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Drive Object attribute from the context in which it is created

jbailey
17-Peridot

Drive Object attribute from the context in which it is created

Is there a way to use an attribute that is set on the context to drive an attribute for the objects within that context when they are created?

 

Something like assigning a "code" to the product, and make the attribute for a CR/CN/PR/Variance/DR etc match that same code

8 REPLIES 8
Florent
14-Alexandrite
(To:jbailey)

Unfortunately no, unless you create your own rule algorithm.

However, you can use the context name (something like containerName) to extract a sub string (that would be your code).

 

Florent ROUSSEL
www.4cad.ca
jbailey
17-Peridot
(To:Florent)

On the surface, it seems it seems it should be much easier than that.  Why do I find myself saying that more and more with PTC stuff? 🙂

Florent
14-Alexandrite
(To:jbailey)

You could try to create an alias attribute, but it might not address your need as the value would change if the object is moved from a context to another.

 

Florent ROUSSEL
www.4cad.ca

This should be very doable.
In short, when a brand new object is created you want one of its attribute’s value to be automatically set based on the value of its Context’s (Product or Library) attribute.

If this is what you want, write a listener to listen for post store event. Then check if the object meets your criteria for being “new” and whatever else (maybe this only applies to WTParts for example) . If it is “new” set its attribute value per your spec.

What I’ve described is doable but if I’ve misunderstood maybe you could clarify a bit more.

If you need more help feel free to contact me.
jbailey
17-Peridot
(To:d_graham)

That is exactly what I am looking for!

So I have a business attribute for the Context (GRC_PROJ_CODE) value 123456.  I would like to be able to create new objects, and use that attribute to help in auto numebring.  Something like CR-123456-(5dig seq).  Any help you have on this would be appreciated

 

projcode.JPG

Florent
14-Alexandrite
(To:jbailey)

Then this should be achieved with a Custom Rule Algorithm and not a listener.

Florent ROUSSEL
www.4cad.ca

I tend to agree now that we know we’re setting the object’s number.
Initially I thought we were editing an IBA.

Good call.

Ok, so you want to renumber the object per the Context IBA value. Still doable.

Can we take this off line. Contact me directly please. I believe my contact info is viewable. If not reply with your contact info.
Announcements

Top Tags