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

How to update IBA value without object checkout and checkin

Participant

How to update IBA value without object checkout and checkin

I do have IBA attribute field on the wizard table. I want to update that attribute without check out and checkin object.

I have tried using following code for that. But getting error message that "Design is not checked out and cannot be modified".

object.load("XXXXX","YYYY","ZZZ");

  /* Set value of IBAName soft attribute to IBAValue */

  object.set("XXXX", strCNo);

  object.set("YYY", strCS);

  object.set("ZZZ", strAS);

  perObj = object.apply();

  perObj = (Persistable) PersistenceHelper.manager.modify(perObj);

7 REPLIES 7

Re: How to update IBA value without object checkout and checkin

Re: How to update IBA value without object checkout and checkin

Hi Binesh,

Appreciate your prompt response. I will try to evaluate the mentioned package. It would be great if you help with some pseudo code if any.

Re: How to update IBA value without object checkout and checkin

I got workaround for this: below is the code

PersistableAdapter  perAdap = new PersistableAdapter(perObj, null, Locale.US, new UpdateOperationIdentifier());

  perAdap.load("XXXX");

  perAdap.set("XXXX", str);

  perObj= perAdap.apply();

Re: How to update IBA value without object checkout and checkin

Hi,

You need to persist your modifications :

The following code does what you want and uses the PersistableAdapter.

A direct use of IBAValueDBService may be prohibited by the thought police...

import com.ptc.core.lwc.server.PersistableAdapter
import com.ptc.core.meta.common.UpdateOperationIdentifier
import wt.fc.Persistable
import wt.fc.PersistenceServerHelper
import wt.iba.value.DefaultAttributeContainer
import wt.iba.value.service.IBAValueDBService
import wt.part.WTPart

WTPart p;


PersistableAdapter obj = new PersistableAdapter(p, null, Locale.US, new UpdateOperationIdentifier());
obj.load("SOUS_CHAPITRE");
obj.set("SOUS_CHAPITRE", "Ploum, ploum, tra-la-la");
p = (WTPart)obj.apply();

// Here is the trick
IBAValueDBService ibaserv = new IBAValueDBService();
ibaserv.updateAttributeContainer(p, ((DefaultAttributeContainer)p.getAttributeContainer()).getConstraintParameter(),null,null);

PersistenceServerHelper.manager.update((Persistable)p);

Re: How to update IBA value without object checkout and checkin

thanks olivier for your prompt help and support.

Re: How to update IBA value without object checkout and checkin

Please suggest a way to update values on the EPM Document too. As current code is showing some issue like: "Attribute values cannot be added, removed, or changed"

Re: How to update IBA value without object checkout and checkin

Yes, EPMDocuments cannot be managed with this API.

You need to use EPMWorkspaceHelper.manager.setAttributes, as described in the link below.

https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS110292&art_lang=en&posno=5&q=EPMWorkspace...

Some limitations :

  • You need to do a checkout/checkin in a workspace.
  • If you have a family table, you have to checkout the whole family table.
Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum! ______________________________ Check out the Windchill Tips Board! We're talking about Whirlpool's use of digital twin, augmented reality, and data-driven design!

The NAVIGATE WORKING GROUP is here! Come innovate with PTC!

Sign up for a Working Group