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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

WINDCHILL MULTIVALUED API

VM_10716163
4-Participant

WINDCHILL MULTIVALUED API

Looking for API to set multiValue Attribute in create page of Promotion Request.

Values are taken from another MultiValued attribute.

 

EG:

 

Product under which PR is getting created has attribute A with values A,B,C

 

When I am creating Promotion request , attribute in PR should take values from that attribute of product (Multivalued and editable)

VM_10716163_0-1690482613305.png

 

 

Help would be appriciated.

Thanks

 

ACCEPTED SOLUTION

Accepted Solutions

Hi @abhishekarya 

 

In the crate wizard a promotion request object does not exists so you can not get them. 

In data utility in the crate wizard you can get a context where the wizard is activated and get the parameter from that context (product library)

 

Also the multivalued attributes are separated by "@" character 

 

PetrH

View solution in original post

3 REPLIES 3

Get Multi IBA Value :

PersistableAdapter chObj;
chObj = new PersistableAdapter(persistable, null, Locale.US, null);
chObj.load(s);
Object ibaObject= chObj.get(s);
LOGGER.debug("getIBAValue: " + chObj.getAsString(s));
return ibaObject;
 
When you use above method, you can just check the instance of and see if its an array and parse multi values to set:
if (objValue instanceof Object[]) {
  Object values[] = (Object[]) objValue;
          for (Object value : values) {
          basePartFinishCodes.add(value.toString());
          }
  }

 

Set Multi IBA Value, you just need to pass an Array of values to set:

PersistableAdapter adapter = new PersistableAdapter(obj, null, Locale.US, null);
 
adapter.load(attrName);
adapter.set(attrName, value);
obj = adapter.apply();
 
IBAValueDBService ibaserv = new IBAValueDBService();
ibaserv.updateAttributeContainer((IBAHolder)obj, ((DefaultAttributeContainer)((IBAHolder)obj).getAttributeContainer()).getConstraintParameter(),null,null);
PersistenceServerHelper.manager.update(obj);

Hello Abhishek,

 

Thanks for your response.

But in create page of PR , I am not seeing object as Promotion request.

Object is coming as wtpart on which this PR is getting created?

How can I get PR object (in Data utility Create page)

Hi @abhishekarya 

 

In the crate wizard a promotion request object does not exists so you can not get them. 

In data utility in the crate wizard you can get a context where the wizard is activated and get the parameter from that context (product library)

 

Also the multivalued attributes are separated by "@" character 

 

PetrH

Announcements

Top Tags