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

We are happy to announce the new Windchill Customization board! Learn more.

How to retrive multivalued attribute value in java program

giridhar82
1-Newbie

How to retrive multivalued attribute value in java program

HI


multivalued attribute value in using API?


Regards


Giridhar

2 REPLIES 2

Giri,

Here is the two sets of main scripts. You need to build other logics based on your needs. I assume you are in 10 or above and looking API to get IBA values.

//load obj and get IBA Values of IBA
LWCNormalizedObject normalizedObject = new LWCNormalizedObject(wtPart, null, SessionHelper.getLocale(), null);
normalizedObject.load(ibaName);
Object ibaValue = normalizedObject.get(ibaName);


/*
* This can be used to get only String type IBA value
*/
public static String getIBAValues(Object ibaValue){
String ibaValues = ";

if(ibaValue instanceof Object[]) {
Object[] ibaValueArray = (Object[]) ibaValue;
for (Object aIbaValue : ibaValueArray) {
if ((ibaValues.length()) > 0) {
ibaValues = ibaValues + ",";
}
ibaValues = ibaValues + (String) aIbaValue;
}
}
else{
ibaValues = (String)ibaValue;
}
return ibaValues;
}
}

Shown code only to retrieve string type. You can adjust code to take care other data types.

Thanks
Ayyappan

Thanks Ayyappan.

It worked perfectly fine.


On Wed, Apr 30, 2014 at 6:05 PM, Rajagopal, Ayyappan <
-> wrote:

> Giri,
>
>
>
> Here is the two sets of main scripts. You need to build other logics based
> on your needs. I assume you are in 10 or above and looking API to get IBA
> values.
>
>
>
> //load obj and get IBA Values of IBA
>
> LWCNormalizedObject normalizedObject = new LWCNormalizedObject(wtPart,
> null, SessionHelper.getLocale(), null);
>
>
> normalizedObject.load(ibaName);
>
> Object ibaValue = normalizedObject.get(ibaName);
>
>
>
>
>
> */**
>
> ** This can be used to get only String type IBA value*
>
> **/*
>
> *public static String getIBAValues(Object ibaValue){*
>
> * String ibaValues = ";*
>
>
>
> * if(ibaValue instanceof Object[]) {*
>
> * Object[] ibaValueArray = (Object[]) ibaValue;*
>
> * for (Object aIbaValue : ibaValueArray) {*
>
> * if ((ibaValues.length()) > 0) {*
>
> * ibaValues = ibaValues + ",";*
>
> * }*
>
> * ibaValues = ibaValues + (String)
> aIbaValue;*
>
> * }*
>
> * }*
>
> * else{*
>
> * ibaValues = (String)ibaValue;*
>
> * }*
>
> * return ibaValues;*
>
> * }*
>
> *}*
>
>
>
> Shown code only to retrieve string type. You can adjust code to take care
> other data types.
>
>
>
> Thanks
>
> Ayyappan
>
>
>
>
>
> *From:* Giri G [
Top Tags