Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ocean1

Pages: [1]
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.

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

2
Automation Interface, Add-Ins and Tools / Re: Custom SQL query problem
« on: January 22, 2016, 04:46:40 pm »
All solutions in google based on WM_CONCAT, GROUP_CONCAT, FOR XML, but it impossible to implement in EA.

Script fragment means that I should write script with help of javascript, VB script and etс?

3
Automation Interface, Add-Ins and Tools / Custom SQL query problem
« on: January 19, 2016, 01:05:15 am »
Hi guys!
I have a problem with document generation in EA. I made custom query that show tagged values and type for attribute.
Code:
Code: [Select]
select a.Name as ATTR, a.Type AS TYPE, a.stereotype AS STEREOTYPE, tv.Property as tagName, tv.Value AS tagValue
from (t_attributetag tv
inner join t_attribute a on tv.ElementID = a.ID)
where a.Object_ID = #OBJECTID#
But it generates like 1st table. But I need the second. Please tell me how should I change query?

4
Bugs and Issues / Re: Tagged value
« on: January 19, 2016, 12:21:21 am »
In that case you would have to replace the whole attribute table by a query, reporting all tagged values in one field.

Geert

I use the your query
Code: [Select]
select a.Name as Attribute,a.Type, tv.Property, tv.Value, tv.Notes as Memo
from (t_attributetag tv
inner join t_attribute a on tv.ElementID = a.ID)
where a.Object_ID = #OBJECTID#
and tv.Property not in ('#Property','AnotherTagToIgnore')

 and I get this (1st table). But I cant change query. I need table like 2nd table(

5
Bugs and Issues / Re: Tagged value
« on: January 18, 2016, 10:16:17 pm »
In that case you can use something similar to
Code: [Select]
select a.Name as Attribute,a.Type, tv.Property, tv.Value, tv.Notes as Memo
from (t_attributetag tv
inner join t_attribute a on tv.ElementID = a.ID)
where a.Object_ID = #OBJECTID#
and tv.Property not in ('#Property','AnotherTagToIgnore')

Geert

Thank you. But can I do it if template will be situate in table.


So how can I change the query?
I tried:
Code: [Select]
select tv.Property AS Name, tv.Value AS Value
from t_attributetag tv
inner join t_attribute a on tv.ElementID = a.ID
where a.ID = #AttributeID# and tv.Property not in ('#Property')
But it does not work :(
I must report some important documents, please help

6
Bugs and Issues / Re: Tagged value
« on: January 15, 2016, 10:05:42 pm »
If the standard template options don't really give you what you need you may want to consider an SQL template fragment.
The query could be as simple as
Code: [Select]
select tv.Property, tv.Value, tv.Notes as Memo from t_objectProperties tv
where tv.Object_ID = #OBJECTID#
and tv.Property not in ('#Property')

There's a pretty decent learning centre (ALT-F1) article about SQL template fragments if you don't know how they work.

Geert

Thank you for help. I am not good in SQL queries, but it does not work because tagged values is situated on the attributes. This query show only tagged value on object type.
But how can I report list of attributes in table like? :(



| Attribute Name | Attribute Type | Attribute Tagged Values      |
------------------------------------------------------------------
|    Address         |        String      |   #Property: PropertyValue  |
------------------------------------------------------------------
|       ...               |                        |                                            |
------------------------------------------------------------------

7
Bugs and Issues / Re: Tagged value
« on: January 15, 2016, 05:38:16 pm »
Hi all,
I have a problem with tagged value. I want to exclude the tagged value for all attributes that contain this from report.
Its name #Property. I cant do this with options in template on “Element filters”.  I think that does not work in EA :(
Could anyone help me?
Thank you!

Hi there, you should start your own thread with your question, not hijack someone else's.

In answer to what I think your question is, have you looked under Document Options | Element Filters | Add Filters | Attribute.AttTagValue ?

Yes, I saw it. But it doesnt work with any tag value's name and value.
Maybe someone saw the case like that.

8
Bugs and Issues / Re: Tagged value
« on: January 15, 2016, 01:22:20 am »
Hi all,
I have a problem with tagged value. I want to exclude the tagged value for all attributes that contain this from report.
Its name #Property. I cant do this with options in template on “Element filters”.  I think that does not work in EA :(
Could anyone help me?
Thank you!

Pages: [1]