1
Automation Interface, Add-Ins and Tools / Re: Custom SQL query problem
« on: January 22, 2016, 08:41:42 pm »
I am not developer
I do not know vb and js.
Could you please say what i must change in this code.

Could you please say what i must change in this code.
Code: [Select]
option explicit
!INC Local Scripts.EAConstants-VBScript
function MyRtfData (objectID, tagname)
dim xmlDOM
set xmlDOM = CreateObject( "MSXML2.DOMDocument.4.0" )
xmlDOM.validateOnParse = false
xmlDOM.async = false
dim node
set node = xmlDOM.createProcessingInstruction( "xml", "version='1.0'")
xmlDOM.appendChild node
'
dim xmlRoot
set xmlRoot = xmlDOM.createElement( "EADATA" )
xmlDOM.appendChild xmlRoot
dim xmlDataSet
set xmlDataSet = xmlDOM.createElement( "Dataset_0" )
xmlRoot.appendChild xmlDataSet
dim xmlData
set xmlData = xmlDOM.createElement( "Data" )
xmlDataSet.appendChild xmlData
'loop the Attributes
dim element as EA.Element
set element = Repository.GetElementByID(objectID)
dim attribute as EA.Attribute
if element.Attributes.Count > 0 then
for each attribute in element.Attributes
addRow xmlDOM, xmlData, attribute
next
MyRtfData = xmlDOM.xml
else
'no attributes, so return empty string
MyRtfData = ""
end if
end function
function addRow(xmlDOM, xmlData, attribute)
dim xmlRow
set xmlRow = xmlDOM.createElement( "Row" )
xmlData.appendChild xmlRow
dim xmlAttributeName
set xmlAttributeName = xmlDOM.createElement( "Name" )
xmlAttributeName.text = attribute.Name
xmlRow.appendChild xmlAttributeName
dim xmlAttributeType
set xmlAttributeType = xmlDOM.createElement( "Type" )
xmlAttributeType.text = attribute.Type
xmlRow.appendChild xmlAttributeType
dim xmlAttributeNotes
set xmlAttributeType = xmlDOM.createElement( "Notes" )
xmlAttributeName.text = attribute.Note
xmlRow.appendChild xmlAttributeNotes
dim xmlAttributeStereotype
set xmlAttributeStereotype = xmlDOM.createElement( "Stereotype" )
xmlAttributeStereotype.text = attribute.Stereotype
xmlRow.appendChild xmlAttributeStereotype
dim tags as EA.Collection
set tags = attribute.TaggedValues
' List all element tags
for i = 0 to tags.Count - 1
dim currentTag as EA.TaggedValue
set currentTag = tags.GetAt( i )
dim xmlAttributeTag
set xmlattributeTag = xml.DOM.createElement( "Tags")
xmlAttributeTag.text = (currentTag.Name & ": " & currentTag.Value)
xmlRow.appendChild xmlAttributeTags
end function