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 - Sorno

Pages: 1 2 [3] 4 5
I appreciate the help you're giving, but I don't think the problem is the SQL query per se.

The query works fine when it's "SELECT *", but it does not work when it's "SELECT Count(*)". EA usually throws an nice error explaining that there is an error with a SQL query if this is the case. One way or the other the problem is not in regards to the ObjectID. I get the same results with Element.ElementID.ToString() or even if I hardcode an ID.

The error I'm getting is this:

Are you sure it's possible to do a SELECT COUNT(*) with repository.SQLQuery? By the way, I tried to do a Count outside validation with the same error as result.

Did you run it as part of a model validation ? My query is executed as part of a model validation rule.

Why I ask is that I get the same error with your query as with mine, when executed this way. The /' before the Object ID is to add ' before and after the ID. I reckon objectID.tostring() works equally, or better. :)

The exact query during runtime is:
SELECT COUNT(*) FROM  t_connector WHERE  t_connector.Stereotype LIKE 'Architecture' AND t_connector.End_Object_ID =19

And it throws the same strange error dialog as before. It only throws this if I use count (*),  the following query works:
SELECT * FROM  t_connector WHERE  t_connector.Stereotype LIKE 'Architecture' AND t_connector.End_Object_ID =19

Ah.. the error was in the SQL query. I tried to use SELECT COUNT (*) - I guess the API doesn't like that.

The Repository.SQLQuery still returned an answer so I thought it was OK:

<?xml version="1.0"?>
<EADATA version="1.0" exporter="Enterprise Architect">

But I see now that its empty, which it should not be.

The query:
                        "FROM t_connector " +
                        "WHERE t_connector.End_Object_ID=\'" + Element.ElementID + "\' " +
                        "AND t_connector.Stereotype = 'Architecture'";

When writing these rules do you use the API or SQL-queries?

I was wondering about the efficiency of validation if you need to do alot of looping through elements? I tried to do a check with Repository.SQLQuery but if used during validation it throws this error in EA:

Code = 0x0
Source = Line : 0; Char: 0
Error description = (null)

I get a reply from the SQL query so it works. It seems that the mere present of Repository.SQLQuery throws an error.

Using EA 10.0.1010


I'm fiddling around with custom SQL for RTF-reporting  and have hit a brick wall.

When trying to use functions like Declare or IF the query returns no data when executed through EA (custom query and sql search). The model is hosted on a Microsoft SQL server och the query works fine if runned directly on the database.

Is this a hard limitation in  EA v10.0.1010?

Have a great weekend!

Alright! Too bad we won't be able to upgrade to v.11 for a while...

Thanks for the info and have a nice weekend.

In a fragment is it in any way possible to do a SQL query and work with the results as elements, rather than just Custom Field?

I have tried by letting the query return
Select t_object.ea_guid AS CLASSGUID, t_object.Object_Type AS CLASSTYPE but to no use.

My problem:

I want to list elements (from a custom query) and certain elements that they are connected to, but not all. When I set element filters they only seem to be applied to the inital list of elements, not the elements they are connected to.

Any way to filter them as well?


Ok, thank you for your reply.

I'm using 10.1010, so I guess that feature was sent back to the drawing board. Bummer, I guess I'm out of luck with v.10 then.


In EA 10 I'm using the RTF-generator to do a custom SQL query that returns two columns Name and Note of elements. It works alright for all element that both have a name and an non-empty note-field. For the cases where the note-field is empty the RT-generator prints "Note" (the name of the custom field). I presumed it would just skip to write anything if the field was empty.

A ugly-workaround is to set all note-field to atleast contain a empty space, but this also mean that an empty  row is added after each element. Any other way?

Thank you!

Automation Interface, Add-Ins and Tools / Re: MDG Use Case sterotype
« on: March 11, 2014, 01:13:44 am »
"DrawNativeShape()" gives you the regular shape of the type in question.


In my addin I use EA_OnPostNewElement to automatically set stereotype and name of certain elements that are either invocation and property.  I have a few issues though with elements created as property.

First issue:
The  EA_OnPostNewElement is called twice, first without information of PropertyType (the value is 0). Then the dialog is shown and after that EA_OnPostNewElement is called for the second time (now with PropertyType set to correct elementID). Since I don't have the PropertyType the first time I can't identify the kind of element that is created and suppress the dialog accordingly.

Second issue:
If the new element (created as propety) is created as a subelement (dragged and dropped on a existing element) it's name isn't updated in the diagram nor in the browser. The stereotype is changed though. I find this odd since I change them at the same time.
Edit: In this case the  EA_OnPostNewElement is not called at first, instead the user dialog is shown and afterwards EA call EA_OnPostNewElement.

Code: [Select]
element.Stereotype = "UsedConfiguration";
element.Name = propertyType.Name;

Using EA 10.1009.

Thank you for your input!

The fix in EA 11, was that to fix that the attribute wasn't inherit before?

I saw that this was reported as a bug in 2011, and in EA 10.0.1009 it seems that _defaultDiagramType only work on stereotypes that directly extends the metaclass. Is there any way around this (except to upgrade to EA 11)?


Sorry, I was perhaps a bit unclear. I was just clarifying that the original poster (OP) have deleted his post. So my first post above is an reply to a post no longer present - not a question in itself.   :)  

I guess a moderator should delete the whole thread. Anyway, have a good week.

Note: OP have deleted his post.

Would this work for you?

Repository.GetElementByid (DiagramObject.elementID).ElementGUID

Pages: 1 2 [3] 4 5