cancel
Showing results for 
Search instead for 
Did you mean: 

Extracting attribute values through Java API

Former Member
0 Kudos

I have a requirement where i need to extract values corresponding to a attribute using java api.Iam able to retrieve attributes using catalogData.GetAttributes("Categories") method.How to extract values for the attributes?

Thanks in advance

suresh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Suresh,

What do you mean by "extract values corresponding to an attribute"?

There are 3 types of attributes:

Feature - text values;

Characteristic - numeric values;

Coupled - coupled numeric values.

Examples of these are:

Feature: Colour (red, green, blue)

Characteristic: Length (1 mm, 2.5 mm, ...etc)

Coupled: Boiling Temperature( 100 deg celcius @ 0 m)

ONLY Feature Attributes have a predefined set of values to choose from.

Here is some code which displays all the feature attributes and their available feature values:


try
{
	AttributeInfoArray attributeInfos = catalogData.GetAttributes("Product Categories");
	for(int i = 0; i < attributeInfos.GetSize(); i++)
	{
		AttributeInfo attributeInfo = attributeInfos.GetAttributeInfoAt(i);
		if(CMDBTypes.IsFeature(attributeInfo.GetType())) 
		{
			System.out.println(attributeInfo.GetName());
			FeatureDomain featureDomain = attributeInfo.GetFeatures();
			for(int fdIdx = 0; fdIdx < featureDomain.GetSize(); fdIdx++)
			{
				FeatureValue featureValue = featureDomain.GetFeatureValueAt(fdIdx);
				System.out.println("   " + featureValue.GetValue());
			}
			System.out.println("***************************************************");
		}
	}
}
catch (StringException e)
{
	e.printStackTrace();
}

Regards,

Walter

Answers (0)