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

How to update IBA value without object checkout and checkin

anabors-keating
4-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

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.

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();

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);

thanks olivier for your prompt help and support.

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"

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=EPMWorkspaceHelper.manager.setAt…

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

Top Tags