Skip to main content
1-Visitor
April 30, 2014
Question

How to retrive multivalued attribute value in java program

  • April 30, 2014
  • 2 replies
  • 1792 views

HI


multivalued attribute value in using API?


Regards


Giridhar

2 replies

11-Garnet
April 30, 2014
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

1-Visitor
April 30, 2014
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 [