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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Modify Part Usage Attributes without creating a iteration of the parent part

hsha1102
11-Garnet

Modify Part Usage Attributes without creating a iteration of the parent part

Hello,

 

Is it possible to modify part usage attribute (Quantity) without creating a new iteration of the parent or doing a check-out/check-in?

 

I have the following code to modify "findNumber" which is also a usage attribute. Please provide your suggestions.

 

QueryResult qr = WTPartHelper.service.getUsesWTPartMasters(parentPart);

while (qr.hasMoreElements()) {
WTPartUsageLink ul = (WTPartUsageLink) qr.nextElement();
WTPartUsageLink usageLink;
PersistableAdapter obj = new PersistableAdapter(ul, null, null, new UpdateOperationIdentifier());
obj.load(attName);//attName="findNumber"
obj.set(attName,attValue);
usageLink = (WTPartUsageLink)obj.apply();

IBAValueDBService ibaserv = new IBAValueDBService();
ibaserv.updateAttributeContainer(usageLink,((DefaultAttributeContainer)usageLink.getAttributeContainer()).getConstraintParameter(),null,null);
PersistenceServerHelper.manager.update((Persistable)usageLink);

}

 

Regards,

Hari R

 

ACCEPTED SOLUTION

Accepted Solutions

I am not a Windchill developer and someone else in the community may know a way to change Quantity without checking out.  As a business administrator, this request raises some red flags.  I think the question might be better phrased as "Should we be able to modify Quantity without checking out the product structure?"

 

Here is a quick analogy.  In change/configuration management, companies often allow users to perform minor changes to released objects (like fixing a typo or displaying a missing note/dimension) without forcing a full change process.  Any change to a design that affects the Form/Fit/Function (FFF) of the product structure (like moving a hole or changing quantity) requires iterating the structure and processing the change thru a Change Notice.

 

Find Number is valuable downstream information, but it does not affect FFF of the product.  Changing the Find Number could be equated to correcting a typo.  So, an argument could be made for treating the Find Number like a minor change.  Just make the change and don't worry about iterating the product structure.

 

Quantity is always a change to the FFF of the product.  In the analogy, we are required to use a Change Notice to update Quantity.  Since we are doing it thru code, we are "authorized" by the business to make the change at the point in the process where this code will be executed.  It may even be permissible for the custom code to modify a released structure without going thru a Change Notice or state change.  But it is still a FFF change and requires an iteration of the product structure.

 

To summarize, all desired changes should be validated against the business rules before trying to code them.  Per configuration management, all FFF changes require a check out.  Non-FFF changes might be possible/permissible without check out.

 

This isn't the answer you wanted but hope it helps justify the conceptual differences between Find Number and Quantity.

View solution in original post

5 REPLIES 5

You need to modify your code for

ibaHolder = (IBAHolder) obj.apply(); 
AttributeContainer partContainerAfterUpdateOfSoftAttrs = new IBAValueDBService().updateAttributeContainer(ibaHolder, obj, null, null);
ibaHolder.setAttributeContainer(partContainerAfterUpdateOfSoftAttrs);

 No need to use "PersistenceServerHelper".

 

 

Hello @froussel_fr ,

 

Thanks for the suggestion. But still I am not able to modify "quantity" attribute of usage link object. 

 

Is there any way where we can modify "quantity" without creating a new iteration?

 

PFB snapshot. I have tried providing the internal as well.

hsha1102_0-1583484376326.png

 

Florent
15-Moonstone
(To:hsha1102)

Well, the code you provided was mentioning "find number", didn't pay attention "quantity" in the question.

 

The quantity being a special field (with consequences on occurrence links), I would suggest to try with

WTPartUsageLink.setQuantity() and then PersistenceServerHelper.

 

Florent ROUSSEL
www.4cad.ca

Hello @Florent ,

 

Thanks for the response.

 

But to modify the attribute with usageLink.setQuantity(), the parent must be in checked out state in order to persist the change which will result in creating a new iteration of the parent part. So I cannot use the solution that you mentioned.

 

Regards,

Hari Shankar

I am not a Windchill developer and someone else in the community may know a way to change Quantity without checking out.  As a business administrator, this request raises some red flags.  I think the question might be better phrased as "Should we be able to modify Quantity without checking out the product structure?"

 

Here is a quick analogy.  In change/configuration management, companies often allow users to perform minor changes to released objects (like fixing a typo or displaying a missing note/dimension) without forcing a full change process.  Any change to a design that affects the Form/Fit/Function (FFF) of the product structure (like moving a hole or changing quantity) requires iterating the structure and processing the change thru a Change Notice.

 

Find Number is valuable downstream information, but it does not affect FFF of the product.  Changing the Find Number could be equated to correcting a typo.  So, an argument could be made for treating the Find Number like a minor change.  Just make the change and don't worry about iterating the product structure.

 

Quantity is always a change to the FFF of the product.  In the analogy, we are required to use a Change Notice to update Quantity.  Since we are doing it thru code, we are "authorized" by the business to make the change at the point in the process where this code will be executed.  It may even be permissible for the custom code to modify a released structure without going thru a Change Notice or state change.  But it is still a FFF change and requires an iteration of the product structure.

 

To summarize, all desired changes should be validated against the business rules before trying to code them.  Per configuration management, all FFF changes require a check out.  Non-FFF changes might be possible/permissible without check out.

 

This isn't the answer you wanted but hope it helps justify the conceptual differences between Find Number and Quantity.

Announcements

Top Tags