Book a Demo

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

Pages: [1]
1
General Board / Re: Listing the "visible" attributes in a diagram.
« on: January 31, 2019, 10:17:51 am »
Hi all,

I was able to figure it out eventually and here's the query I came up with (see below). It turns out that the AttCustom variable can be set to 0 or 1 and that flips the meaning of whether the attributes listed in the t_diagram.StyleEx column are hidden or shown.  Sure would be great if Sparx would provide a document so users could figure out how to parse t_diagram.StyleEx and t_diagrambbjects.ObjectStyle.  I never try to change the values there and wouldn't mind if they changed the rules, if they would just share the meaning of the stuff in there.  Using the <Search Term> variable works sporadically at best for my semi-old copy of EA, so I've been substituting the actual diagram name before running the query.  And we're going to have to figure out how to display the Description (notes fields) in a way that eliminates our newlines and commas (separate post).  For what it's worth, here's the query - hope someone finds it useful:

SELECT
t_diagram.name AS [DIAGRAM NAME],
t_object.name AS [CLASS NAME],
t_attribute.name AS [ATTRIBUTE NAME],
t_attribute.type AS [DATA TYPE],
t_attribute.lowerbound+'..'+t_attribute.upperbound AS [CARDINALITY],
t_attribute.Notes AS [DESCRIPTION]
FROM ((t_diagramobjects
INNER JOIN t_object ON t_object.Object_ID = t_diagramobjects.Object_ID)
INNER JOIN t_diagram ON t_diagram.Diagram_ID = t_diagramobjects.Diagram_ID)
INNER JOIN t_attribute ON t_attribute.Object_ID = t_object.Object_ID
WHERE t_diagram.name = '<Search Term>'
AND t_object.Object_Type = 'Class'
AND (
      (
       (INSTR(t_diagram.StyleEx,MID(t_object.ea_guid,2,6)) = 0)
   AND (INSTR(t_diagramobjects.ObjectStyle,'AttPro=0;AttPri=0;AttPub=0;AttPkg=0') = 0)
   AND (INSTR(t_diagramobjects.ObjectStyle,'AttCustom=0') = 0)
   AND "COMMENT:  this set brings back attributes for classes where nothing is hidden."
     )
   OR (
       (INSTR(t_diagramobjects.ObjectStyle,'AttPro=0;AttPri=0;AttPub=0;AttPkg=0') > 0)     
    AND (INSTR(t_diagram.StyleEx,MID('S_'+t_object.ea_guid,2,6)) > 0)
    AND (INSTR(t_diagram.StyleEx,MID(t_attribute.ea_guid,2,6)) = 0)
   AND "COMMENT:  this set evaluates to false so that it excludes attributes for classes where all attributes are hidden."
     )   
   OR (
        (INSTR(t_diagram.StyleEx,MID(t_attribute.ea_guid,2,6)) = 0)     
    AND (INSTR(t_diagram.StyleEx,MID(t_object.ea_guid,2,6)) > 0)
   AND (INSTR(t_diagramobjects.ObjectStyle,'AttCustom=0') > 0)
   AND "COMMENT:  this set shows unhidden attributes, whether hidden ones are selected individually or using the custom All button."
     )
   OR (
        (INSTR(t_diagram.StyleEx,MID(t_attribute.ea_guid,2,6)) > 0)     
    AND (INSTR(t_diagram.StyleEx,MID(t_object.ea_guid,2,6)) > 0)
   AND (INSTR(t_diagramobjects.ObjectStyle,'AttCustom=1') > 0)
   AND "COMMENT:  this set shows unhidden attributes, whether hidden ones are selected individually or using the custom All button."
     )
   )
UNION ALL
SELECT
t_diagram.name AS [DIAGRAM NAME],
t_object.name AS [CLASS NAME],
'' AS [ATTRIBUTE NAME],
'' AS [DATA TYPE],
'' AS [CARDINALITY],
t_object.Note AS [DESCRIPTION]
FROM ((t_diagramobjects
INNER JOIN t_object ON t_object.Object_ID = t_diagramobjects.Object_ID)
INNER JOIN t_diagram ON t_diagram.Diagram_ID = t_diagramobjects.Diagram_ID)
WHERE t_diagram.name = '<Search Term>'
AND t_object.Object_Type = 'Class'
ORDER BY 1, 2, 3;

2
General Board / Re: Listing the "visible" attributes in a diagram.
« on: January 11, 2019, 12:06:33 pm »
Hi

Sorry for posting something related to the start of a pretty old thread but this is the closest question I've found to what I'm trying to do, so harking back to the beginning of this thread.....I'm trying to create a SQL query to report all elements that appear in a diagram.  The subsequent discussion in this thread notwithstanding, our team finds it very useful to be able to generate diagrams based on discussions of requirements or on questions of what classes & attributes are present in the model to support a given use case.  We use tags to officially document/track what is part of a given use case, but it would really be helpful to run a report on these diagrams we're dynamically generating on a frequent basis.  And we're all pretty good at SQL so we're sticking with that cuz its easy to tweak the query.

If I understand the comments correctly, joining the list of attributes referenced for the SPL variable(?) in t_diagram.StyleEx with the AttCustom in t_diagramobjects.ObjectStyle is supposed to show us what attributes are hidden (AttCustom=0) or displayed (AttCustom=1).  However, when I run a query against a diagram with...
1) a single class with a few attributes where all attributes are displayed and compare the AttCustom value against...
2) the same diagram and class with all attributes hidden via the Feature and Compartment Visibility > Attribute Visibility > All=unchecked, and against...
3) the same diagram and class with some attributes hidden, some displayed via Feature and Compartment Visibility > Attribute Visibility > Custom,
... it turns out they all have AttCustom=0.  No matter how the attributes are hidden.  So, I'm questioning if I have that right. 

How and where exactly does the database capture the various ways to hide and display attributes in diagrams (in all the various combinations)?  My query is currently showing the right attributes when they are mixed displayed and hidden, but it's not showing all attributes when nothing is hidden or when all are hidden, so I'm working on that while awaiting guidance.

Thanks for any feedback you can give!
W.

Pages: [1]