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

Pages: [1] 2
1
General Board / Re: Default Tags by element type
« on: May 02, 2025, 09:09:16 pm »
Thanks!  I'll take a look at this.

2
General Board / Default Tags by element type
« on: May 02, 2025, 12:50:13 am »
I've just discovered that each element type has a set of default Tags, that are stored in the t_objectproperties table.  These default tags show up in the Properties panel in the Properties panel but not in the Element Tags panel.  It also doesn't appear that I can add a tag Note to these default tag.
 1.  How can I find out where these default tag are defined for each element type?
 2.  Can I edit (add/remove, set default Values) for these pre-defined tags?
 3.  Can I exclude the non-null default tags from my HTML report?
      - Not pertinent to original question, but can I exclude certain custom tags from my html report?

I'm currently using Sparx EA 16.0.2605

Thanks in advance for any assistance.

EXAMPLE:
add a "Project::Change" element to a diagram, then select the element and open the Properies panel

Observe: Below the General panel is a new panel unique to "Project::Change" element:

<<Change>> (From Project)
Priority
Complexity
TimeTaken
TimeToComplete
DefinitionOfDone     <memo>
Done                      false

3
Okay, that worked.  I wasn't sure how to use the "JOIN" syntax; but ended with with a working solution.

I Changed the last Join to a "LEFT JOIN" as it seems to make sense on what I'm trying to do:

SELECT org.Name as Org,
      ref.Name as Guidance,
      resp.Name as Responsibility,
      resp.Alias as Responsibility_Type,
      IIF(resp.Alias = "Responsibility", MID(auth.Constraint, INSTR(auth.Constraint, "- ")+2), "None Specified") as Authority
      
FROM ((((((((t_package pkg
INNER JOIN t_diagram diag ON pkg.Package_ID = diag.Package_ID)
INNER JOIN t_diagramObjects dorg ON diag.diagram_ID = dorg.diagram_ID)
INNER JOIN t_object org ON dorg.Object_ID = org.Object_ID)
INNER JOIN t_diagramObjects dref on diag.diagram_ID = dref.diagram_ID)
INNER JOIN t_object ref ON dref.Object_ID = ref.Object_ID)
INNER JOIN t_diagramObjects dresp ON diag.diagram_ID = dresp.diagram_ID)
INNER JOIN t_object resp ON dresp.Object_ID = resp.Object_ID)
LEFT JOIN t_objectConstraint auth ON resp.Object_ID = auth.Object_ID)

WHERE org.Object_Type = "Actor" AND
     (ref.Object_Type = "Artifact" AND
      ref.Alias = "Authoritative Document") AND
     (resp.Alias in ("Responsibility","Reference Task")) AND
    ((resp.Alias = "Responsibility" AND
      resp.Object_ID = auth.Object_ID AND
      auth.Constraint LIKE "Authority*") OR
     (resp.Alias = "Reference Task"))

Which gives the correct (expected) answer:

Org   Guidance   Responsibility                              Responsibility_Type   Authority
======   ==========   ================   ===================   ==========================================================
Actor1   Document 1   Responsibility 1                   Responsibility      Authorized IAW Guidance Document 10  (page 2, para 1.2.1
Actor1   Document 1   Responsibility 2                   Reference Task      Not Specified
Actor1   Document 1   Responsibility 3                   Reference Task      Not Specified



Thanks!

4
Bingo!  Finally got the "JOIN" syntax to work.  For my trouble column, I changed to a LEFT JOIN to get all results and do the lookup for the Responsibility element and it worked Perfectly.  I've been trying to post my final answer, but keep getting and error:  Clean Talk ***Might be SPAM*** or something like that!  Will try to clean it up again and post.

Thanks again!

5
Doing a crash course on W3Schools to figure out how to use the JOIN syntax...  :)

6
You do bring up a good point, one that I debated on how to post as the query works fine except for the last part. 
1.  copy the entire query from my other network and add notes to address the relationships (easiest for me) or
2.  Simplify the query for just the broken part (easier for everyone else)

Based on your comments, I'll simplify the query for just the broken part and use the JOIN ON syntax.  I don't do SQL very well, so it'll take me a bit.
Thanks for the response.

7
I'm trying to create a custom query for a Document Report for a requirements diagram.  I'm having trouble figuring out how to do conditional "WHERE" so that if the "WHERE" is True, display the a value from another table, and if the condition is false to display, "None Specified. 
My query works fine until I attempt this last step and I either only get the value for the true statement and ignores the non-matching rows, OR
I get the the value for the true statement and multiple copies of the the non-matching rows.  Here's my SQL:
Code: [Select]
SELECT   pkg.Name as Package,
diag.Name as Diagram,
org.Name as Organization,
ref.Name as Guidance,
refa.Default as Guidance_Date,
resp.Name as Responsibility,
resp.Alias as Responsibility_Type,
respreq.Requirement as Description,
IIF(resp.Alias = "Responsibility",
     MID(auth.Constraint, INSTR(auth.Constraint, "- ")+2), \\Only if Alias is "Responsibility"
        "None Specified") as Authority   \\If Alias is "Reference Task"
FROM t_package pkg,
t_diagram diag,
t_object org,
t_diagramObjects dorg,
t_object ref,
t_diagramObjects dref,
t_connector cref,
t_attribute refa,
t_object resp,
t_objectrequires respreq,
t_diagramObjects dresp,
t_connector cresp,
t_objectConstraint auth
WHERE pkg.Package_ID = #PACKAGEID# AND        \\ Package
pkg.Package_ID = diag.Package_ID AND \\ Diagram
(dorg.Diagram_ID = diag.Diagram_ID AND  \\ Organization
org.Object_ID = dorg.Object_ID AND
org.Object_Type = "Actor") AND
(dref.Diagram_ID = diag.Diagram_ID AND
dref.Ojbect_ID = ref.Object_ID AND
ref.Object_Type = "Artifact" AND
ref.Alias = "Authoritative Document" AND
cref.Start_Object_ID = org.Object_ID AND
cref.End_Object_ID = ref.Object_ID AND
cref.Connector_Type = "Dependency") AND \\ Guidance Document
(refa.Object_ID = ref.Object_ID AND
ref.Name = "Document Date") AND \\ Guidance Document Date
(dresp.Diagram_ID = diag.Diagram_ID AND
dresp.Object_ID = resp.Object_ID AND
resp.Object_Type = "Artifact" AND
cresp.Start_Object_ID = ref.Object_ID AND
cresp.End_Object_ID = resp.Object_ID AND
cresp.Connector_Type = "Dependency") AND \\ Responsibility ; Identified as either "Responsibility" or "Reference_Task"
(respreq.Object_ID = resp.Object_ID) AND \\ Responsibility Description

((res.Alias = "Responsibility" AND
  resp.Object_ID = auth.Object_ID AND \\ Find "Authority" if a "Responsibility"
  auth.Constraint LIKE "Authority*") OR \\ Extract "Authority" from string, "Authority Reference - MyDocument"
(resp.Alias = "Reference Task") )
Ignoring the  "Authority" column and logic, I correctly get the following Results:

Code: [Select]
Package Diagram Organization Guidance Guidance Date Responsibility Responsibility Type Description
------- ------- ------------ -------- ------------- -------------- ------------------- -----------------
PKG_1 Diag_1 My_Org      SOP_10 1/1/2000    Resp_1    Responsibility      "Resp_1 Desc...."
PKG_1 Diag_1 My_Org       SOP_10 1/1/2000    Ref Tsk 2    Reference Task      "Ref Tsk 2 Desc."
PKG_1 Diag_1 My_Org      SOP_10 1/1/2000    Ref Tsk 3    Reference Task      "Ref Tsk 3 Desc."

The problem comes in when I try to add "Authority".  If the Responsibility_Type is "Responsibility", then an row is added to the t_ObjectConstraint table
with a CONSTRAINT = "Authority Reference - MyDocument", but I only want the text AFTER the " - " (e.g., MyDocument).
adding my code to retrieve the Authority document, my expected results are:
Code: [Select]
Package Diagram Organization Guidance Guidance Date Responsibility Responsibility Type Description       Authority
------- ------- ------------ -------- ------------- -------------- ------------------- ----------------- ----------------------
PKG_1 Diag_1 My_Org      SOP_10 1/1/2000    Resp_1    Responsibility      "Resp_1 Desc...." Authority Document 100
PKG_1 Diag_1 My_Org       SOP_10 1/1/2000    Ref Tsk 2    Reference Task      "Ref Tsk 2 Desc." None Specified
PKG_1 Diag_1 My_Org      SOP_10 1/1/2000    Ref Tsk 3    Reference Task      "Ref Tsk 3 Desc." None Specified

but my actual results are:

Code: [Select]
Package Diagram Organization Guidance Guidance Date Responsibility Responsibility Type Description       Authority
------- ------- ------------ -------- ------------- -------------- ------------------- ----------------- ----------------------
PKG_1 Diag_1 My_Org      SOP_10 1/1/2000    Resp_1    Responsibility      "Resp_1 Desc...." Authority Document 100
PKG_1 Diag_1 My_Org       SOP_10 1/1/2000    Ref Tsk 2    Reference Task      "Ref Tsk 2 Desc." None Specified
PKG_1 Diag_1 My_Org      SOP_10 1/1/2000    Ref Tsk 3    Reference Task      "Ref Tsk 3 Desc." None Specified
PKG_1 Diag_1 My_Org       SOP_10 1/1/2000    Ref Tsk 2    Reference Task      "Ref Tsk 2 Desc." None Specified
PKG_1 Diag_1 My_Org      SOP_10 1/1/2000    Ref Tsk 3    Reference Task      "Ref Tsk 3 Desc." None Specified
PKG_1 Diag_1 My_Org       SOP_10 1/1/2000    Ref Tsk 2    Reference Task      "Ref Tsk 2 Desc." None Specified
PKG_1 Diag_1 My_Org      SOP_10 1/1/2000    Ref Tsk 3    Reference Task      "Ref Tsk 3 Desc." None Specified
....Repeats for a couple hundred rows

Note that my data is on a segregated network so data above is notional but representative, and the SQL and results were hand-typed here, so I apologize in advance if there are any misspellings or syntax errors; there are no errors on the segregated networks, other than the logic error I seeking assistance on.

I appreciate any assistance you all might be able to provide.

8
General Board / Re: View SQL for the current diagram?
« on: May 10, 2022, 11:13:57 pm »
Geert,

That is exactly what I was looking for!  I was just hoping there was a way to view that in system out by enabling enhance logging, or viewing stored procedures. 
It appears these are all embedded in binaries not in the database (for propriety reasons I'm sure).

I've been viewing the "queries" by opening (a copy) of my .eap file directly with Access...this is helpful for getting started and understanding the relationships... but still takes quite a bit off effort to recreate.

Thanks!

9
General Board / View SQL for the current diagram?
« on: May 10, 2022, 03:42:16 am »
Is there a way to have Sparx EA reveal the SQL used to generate a particular diagram?
There are two reasons this would be helpful:
1.  To retrieve portions of specific diagrams (by name or types) for inclusion into MS Excel Pivot tables.
- for possible inclusion to fragments for document reports.
2.  As a learning tool to better the database object relationships

Appreciate any insight on how to view the SQL Sparx EA uses to display a particular diagram.

10
Not to worry.  I have no clue how to incorporate the python code into my JScript.
As this was the last item, I just used a DB hammer to update the column using the Repository.Execute().

I used:
Repository.Execute("UPDATE t_diagramObjects SET ObjectStyle = 'ImageID=1122334455;lwth=0;NSL=0;' WHERE Diagram_ID =" + NewDiagID + " AND Object_ID =" + MyNewObjectID) ;
I then use a Session.Output (Repository.SqlQuery("......" ); to verify in the DB update worked...but not necessary.
NOTE:  MyNewObjectID is the orginal object_ID I'm linking to my selected diagram.

This solved my problem; while not 'perfect' it IS functional.

Thanks for all the inputs.

KSL.

11
Yes.  I agree exactly with what you two are saying.  As I was trying figure this out, I was running SQL.  This showed me that a pretty empty DiagramObject row was created.  Based a link Geert provided on another FORUM response, I discovered how to update the coords (and solved my type-mismatch!).
I also noticed the difference between the original and the new diagram object is the empty ObjectStyle column in t_diagramobjects.

So my only remaining problem is how to update the value in the t_diagramobjects for that new object in my JSCRIPT.  But therein lies the problem!

The Element class doesn't seem to have a diagram objects method...?  And the DiagramObjects Class DOES have a style method (as referenced above).
So my problem is how do I use the Diagram Objects method to update the t_diagramObjects.ObjectStyle column.

I attempted this in my code snippet that I posted yesterday (probably has errors, my working script is on another network and hand-typed it here; sorry!).

NewElement = currentDiagram.DiagramObjects.AddNew( "l=19;r=84;t=-26;b=-95",""); solved one of my problems; it correctly sizes and places my boundary box in the correct location.

The missing value from the diagramObjects.ObjectStyle is:
ImageID=1122334455;lwth=0;NSL=0;DUID=12AD43EI112;

my several attempts to update the diagram object (which failed!) were:

NewElement.ElementStyle = "ImageID=1122334455;lwth=0;NSL=0;" 
NewElement.Element.Style = "ImageID=1122334455;lwth=0;NSL=0;" 
NewElement.ObjectStyle = "ImageID=1122334455;lwth=0;NSL=0;"
NewElement.Object.Style = "ImageID=1122334455;lwth=0;NSL=0;" 

As you can tell above, I've tried to update exactly what you're referring to...but I have no clue how to!
I'm thinking there might be away to add to the currentDiagram.DiagramObjects.AddNew()
such as currentDiagram.DiagramObjects.AddNew("ImageID=1122334455;lwth=0;NSL=0;", "DIAGRAMOBJECTS)  Or something like  that.

Again, I appreciate any assistance,

KSL

12
t_diagram.objectstyle has an entry like

ImageID=1708599719;

along with other semiclon separated blurb. Here you have to add the right id from your image.
In the API you refer that as diagramObject.Style.

Good luck.

q.

This is the rabbit I'm chasing now.   
My latest attempt is:
var myLogoID = 12345;
currentDiagram = Repository.GetTreeSelectedObject();
NewElement = currentDiagram.DiagramObjects.AddNew( "l=19;r=84;t=-26;b=-95","");  \\This correctly sizes my new object!
NewElement.ElementID = myLogoID;
/* my attempts at updating t_diagramObjects.objectstyle:

NewElement.ElementStyle = "ImageID=1122334455;lwth=0;NSL=0;"  \\ This isn't correct, so I tried what you have
NewElement.Element.Style = "ImageID=1122334455;lwth=0;NSL=0;"  \\ Still no dice...so I tried based on Object...?
NewElement.ObjectStyle = "ImageID=1122334455;lwth=0;NSL=0;"  \\ Still no dice....
NewElement.Object.Style = "ImageID=1122334455;lwth=0;NSL=0;"  \\ Still no dice...
*/
NewElement.Update;

As can tell; i have no idea what I'm doing...just throwing spitballs hoping one sticks...

13
I've found another thread you had responded to, reference to another page...this made sense and I'm making progress:
var myLogoID = 12345;
currentDiagram = Repository.GetTreeSelectedObject();
NewElement = currentDiagram.DiagramObjects.AddNew( "","");
NewElement.ElementID = myLogoID;
NewElement.Update;

The almost works!  It places the boundary box on the diagram!  However, the boundary box is an empty boundary box but doesn't show the alternate image!
I don't know the available methods to add the alternate image...or copy the rest of the characteristics from the original in the new diagram object...
Thoughts?

KSL

14
When I entered what I thought I understood:

var myLogo = 12345;
diagram.DiagramObject.AddNew();

I received an error that "diagram" is undefined.  So I borrowed from another part of the script:
var myLogo = 12345;
currentDiagram = Repository.GetTreeSelectedObject();
currentDiagram.DiagramOjbect.AddNew( myLogo);

Now I get a type mismatch error..
Do I need to tell AddNew to expect an object_ID?
 

15
I agree, but when the team approached about adding the logo to the TitleBlock, I did a cursory look and they were pasting as new.  I like creating as a link as you suggest for the exact reason you suggest.

Thanks, I'll give this a try!

Pages: [1] 2