Skip to main content
1-Visitor
May 17, 2017
Question

How to update IBA value without object checkout and checkin

  • May 17, 2017
  • 2 replies
  • 8156 views

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

2 replies

1-Visitor
May 17, 2017
1-Visitor
May 17, 2017

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.

1-Visitor
May 17, 2017

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

15-Moonstone
May 17, 2017

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);
1-Visitor
May 17, 2017

thanks olivier for your prompt help and support.

1-Visitor
May 27, 2017

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"