As suggeste by @Geert Bellekens I had a try with Document Script Fragment and managed to document enumeration data types in a table (each enum in separate row, code and description in separate columns).
my solution approach:
Create a custom template with a template fragment 'templateSelector' in the element >
section.
The fragment 'templateSelector' contains just a custom >
section
In the Document Options of the fragment, go to 'Custom Query' and select 'Document Script' as template fragment type and select via the dropdown the Custom Script ('getAttributeAndType') to get the attributes and their types (see further below). Call the script getAttributeAndType(#OBJECTID#)
in the window and pass the #OBJECTID#
Create a Custom Script. The Custom Script 'getAttributeAndType' gets the attribute name and notes and calls two other templates 'template_simpleType' and 'template_enumType' depending on whether the data type is simple (e.g. FLAG) or an enumeration.
!INC Local Scripts.EAConstants-JScript
var ENUM_TYPE_TEMPLATE = "template_enumType";
var SIMPLE_TYPE_TEMPLATE = "template_simpleType";
function getAttributeAndType(objectID)
{
var docGenerator as EA.DocumentGenerator;
docGenerator = Repository.CreateDocumentGenerator();
if ( docGenerator.NewDocument("") )
{
try
{
var currentElement as EA.Element;
currentElement = Repository.GetElementByID(objectID);
var attributesCollection as EA.Collection;
attributesCollection = currentElement.Attributes;
for ( var i = 0; i < attributesCollection.Count; i++) {
var currentAttribute as EA.Attribute;
currentAttribute = attributesCollection.GetAt(i);
docGenerator.InsertText("Attribute: " + currentAttribute.Name,"");
docGenerator.InsertText("\n","");
docGenerator.InsertText(currentAttribute.Notes,"");
var currentAttributeTypeElement as EA.Element;
currentAttributeTypeElement = Repository.GetElementByID(currentAttribute.ClassifierID);
if(currentAttributeTypeElement.Type == "Enumeration")
docGenerator.DocumentElement(currentAttributeTypeElement.ElementID,1,ENUM_TYPE_TEMPLATE);
else if(currentAttributeTypeElement.Type == "DataType")
docGenerator.DocumentElement(currentAttributeTypeElement.ElementID,1,SIMPLE_TYPE_TEMPLATE);
else Session.Output("Data type not recognized");
}
}
catch(e)
{
Session.Output(e);
}
var rtf = docGenerator.GetDocumentAsRTF();
return rtf;
}
return "";
}
The two templates being called by the script look as follows:
template_enumType:
template_simpleType:
All in all, you need a three templates, one fragment and one script. The first template calls the fragment, the fragment calls the script, the script calls the other two templates.