Hi, I want to retrieve the available categories for a given OT folder, then retrieve the attributes and restrictions for those fields. I am able to retrieve the attribute groups (categories) and for each category, iterate over the data values (attributes). From this attribute there are values (name, key, values) but that is for that instance (the node). But what I really want is the respective attribute (StringAttribute) for that category so I can inspect it's properties (allows nulls, length, etc).
I tried getattributegroupdefinition method but that returns an error with null stack trace, the input argument to that method was the key from the data value (ex 4561.1.4) which I suspect is incorrect. Any help would be much appreciated!!
public string GetAttributes()
{
Node folderNode = m_docManClient.GetNode(ref m_otAuthentication, 5081);
NodeContainerInfo containerInfo = folderNode.ContainerInfo;
Metadata folderMetadata = folderNode.Metadata;
BECMOpenText.cws.AttributeGroup[] folderCategories = folderMetadata.AttributeGroups;
//If you want to validate values you will first need to call GetCategoryTemplate() to get the category definition
// (including default values and valid values).
// For popups, the ValidValues field will be defined on the attribute value.
System.Text.StringBuilder sb = new System.Text.StringBuilder();
foreach(BECMOpenText.cws.AttributeGroup attributeGroup in folderCategories)
{
foreach (DataValue dataValue in attributeGroup.Values)
{
sb.AppendLine("Datavalue attribute is: \t" + dataValue.Description + "\t" + dataValue.GetType().ToString());
// AttributeGroupDefinition attributeGroupDefinition = m_docManClient.GetAttributeGroupDefinition(ref m_otAuthentication, dataValue.GetType().ToString(), dataValue.Key);
//foreach(BECMOpenText.cws.Attribute attribute in attributeGroupDefinition.Attributes)
//{
// sb.AppendLine(attribute.DisplayName + "\t" + attribute.Required.Value);
//}
if (dataValue is StringValue)
{
StringValue val = (StringValue)dataValue;
if (val.Values != null)
{
foreach (string subVal in val.Values)
{
sb.AppendLine(val.Description + Environment.NewLine + subVal);
}
}
}
//if (dataValue.GetType() == typeof(StringAttribute))
//{
// StringAttribute stringAtt = (StringAttribute)dataValue;
//}
}
}
return sb.ToString();
}