I have a class diagram showing tables and the relations. The tables have been restricted on the diagram to show only the attributes I'm interested in, using the "custom" button in the Feature Compartment Visibility dialog. I now want to use the document generator to document the classes and attributes displayed on the diagram in the document text.
While I can use a virtual document with the appropriate query to select the classes in the diagram, passing that into a template which shows the attributes shows all of them. I can't find a way of reducing the list of attributes.
I could use a template to show the class header, and a custom fragment to query the attributes, but it would not be possible to determine within the custom script/sql which diagram was the relevant one, so that doesn't work.
Has anyone managed to do this without a third party tool?
You can get that info in the field StyleEx of the t_diagram
The following example query returns the attributes that are shown on a particular diagram
select a.ea_guid,d.StyleEx from t_diagramobjects do
inner join t_object o on do.Object_ID = o.Object_ID
inner join t_diagram d on d.Diagram_ID = do.Diagram_ID
inner join t_attribute a on o.Object_ID = a.Object_ID
where o.ea_guid = '{0285FC6A-A2CE-479e-B374-5135BD74DACF}'
and d.StyleEx like '%SPL=S_%' + substring(a.ea_guid,2,6) + '%'
This works for SQL-Server, but needs to be adapted to suit your DBMS as substring and wildcards are database specific.
You can set a Scope on the attribute so they will be shown dependent of the scope, for example, your diagram can show only all public attributes.
You can then go into the Diagram Properties, on the features tab, and select which scopes you want to show
Or
You can set a stereotype, for example NotVisible, on an attribute you want to hide.
You then need to go in the feature visibility of each element, and enter the stereotypes you want to hide in the box in the bottom
There are other ways, but this is the gist of it
After that you can use fragments and query on attributes with the defined scope or stereotype
Related
I'm trying to design a custom shape in Visio.
My structure is like this:
In the "Edit Master" page I have some rectangles, I called my shape "MyDay", so that's its document's name in the Master Explorer and in the edit window.
My problem is, that I can't find a way to refer the shape's date itself (like =MyDay!Name() or =MyDay!User.MyUserField) from one of my sub-shapes.
If I add a reference to ThePage and drop the master on a page - I adds that property to the page itself - again - no reference to the main shape from its sub-shapes.
I know there is no "Parent" property in ShapeSheet formulas (only on VBA), but I'm really trying to find a way to refer it using fields or formulas, without the need to write and run VBA code.
Many appreciations for any help!
Paul is correct, but I will add that it is normally expected that a Master contains only one shape, but that can be a group shape that contains other shapes. Therefore, a formula in a sub-shape can refer to any shape in that group, including the top level group shape, using the Sheet.n syntax. When an instance of the master shape is dropped onto a page, then Visio will automatically update the n ID to the actual shape ID in the page. The shape ID has to be unique within the shapes collection that it is part of, so the top-level group shape needs to be assigned a new unique ID, but the sub-shapes do not because they already have an ID that is unique within the shapes collection that they are part of.
You need to find the parent shape's Sheet reference number (select it and then ribbon Developer -> Shape Name -> Shape). This will be something like Sheet.6.
Use this reference in your formula e.g.
Sheet.6!User.MyUserField
I have an my own MDG, consist of several elements. I need change view of those elements when its placed at different diagram. There is a mechanism called "user-selected settings" in MDG and I use its to change view of elements (e.g. via shape script function "HasProp" ). But for several reason I need to change diagram property for element via script. Are there any way to work with diagram property for element within script ?
It's possible but a bit tricky. First of all you need to get hold of the right diagram's table data stored in t_diagram. Issue a SQL like
SELECT StyleEx FROM t_diagram WHERE Diagram_ID = <theID>
Of course <theID> must be the diagram id of the diagram. Now you can use some string operations. Here's what my test diagram brought:
ExcludeRTF=0;DocAll=0;HideQuals=0;AttPkg=1;ShowTests=0;ShowMaint=0;SuppressFOC=1;MatrixActive=0;SwimlanesActive=1;KanbanActive=0;MatrixLineWidth=1;MatrixLineClr=0;MatrixLocked=0;TConnectorNotation=UML 2.1;TExplicitNavigability=0;AdvancedElementProps=1;AdvancedFeatureProps=1;AdvancedConnectorProps=1;m_bElementClassifier=1;ProfileData=;MDGDgm=VW VA Functional 3::Use case activity;STBLDgm=;ShowNotes=0;OPTIONS_9CEFE070=Structure=1:;VisibleAttributeDetail=0;ShowOpRetType=1;SuppressBrackets=0;SuppConnectorLabels=0;PrintPageHeadFoot=0;ShowAsList=0;SuppressedCompartments=;Theme=:119;SaveTag=79E21B13;;
which is a CSV at its best. See the
OPTIONS_9CEFE070=Structure=1:;
which actually encodes the diagram properties. Here it's just one with the name Structure and its value is set to 1. The 9CEFE070 refers to the GUID the diagram object. Of course not directly.
So find the diagram objects of the diagram itself with
SELECT Object_ID, ObjectStyle FROM t_diagramobjects
The Object_ID is for identifying the object behind (you might use a join to get needed information). And the ObjectStlye contains something like (from my test)
DUID=9CEFE070;HideIcon=0;
And there you have that hex string. Now you know that this one object has a diagram property set.
You should issue some queries manually to get familiar with that.
Now, to set a property, you "just" have to find the DUID from the diagram object of the diagram (just use the query above). Now you can add that OPTIONS_<duid> part or in case it already exists you need to modify it with according string operations. Finally you need to update the diagram table with
Repository.Execute("UPDATE t_diagram SET StyleEx = `<new string>` WHERE diagram_id = <theID>")
Note that this is an undocumented operation and you get
a) no support and
b) can easily clobber your whole model which is
c) the reason for a).
Have a backup!
I am trying to use database diagrams in Sparx EA to collect and communicate information about how we are using tables.
I want to add information to columns and have this information show up in a diagram.
For example, the first thing I want to do is note which columns are required in a given application.
I have used the reverse-engineering to import all the many tables into my Sparx project.
It looks like I can extend column information with Tags at least.
But I can't find a way to show my custom tags in a diagram, such as a basic database diagram with tables.
Is there a way to visualize custom tag information for columns in a diagram?
What seems like the most direct example would be such as the following, where a custom "usage" Tag appears after the column name and data type ...
I welcome other options such as conditionally changing the color or font or something based on the Tag,
if adding the Tag name & value is not possible.
I created an attribute set and attribute groups with attributes in it. In the admin panel the attributes are listed in groups, like i created them. But on the front productpage all the attributes are listed together, without displaying the attribute group name first.
I would like to display the Attribute Group Name on the product page (more information tab), before the attributes in this group. How do i do that?
There is no way to do this by default in Magento 2.
There are a few ways I can think of to acheive this. Perhaps best would be to extend the getAdditionalData() method in /Block/Product/View/Attributes.php so that it adds the attribute group name (or id) to the returned array.
You would then need to create a local copy of Magento_Catalog/templates/product/view/attributes.phtml and iterate the array returned by the modified getAdditionalData() method sorting it according to the group name and then output the data with group name headings.
I'd be interested to hear of other or best practice approaches to this type of relatively simple extended functionality in Magento 2.
For this web project, a table listing is implemented in many different places (~60 tables, as in jqgrid tables showing information from db). The table functions are mostly the same (sort, filter, pagination, some custom actions) but there are specific requirements for these (columns to be sorted/filtered, table actions, ...).
I am trying to come up with a right way to model every table with it's specific details. For this I created some default Tagged Values, which I fill in by hand (e.g. table headers = id, special name, direction). I created a default use case "View table" which I copy as a new instance in the use case diagrams for each of the packages that define the tables.
My questions are:
The way I did it doesn't seem to let me to link the default activity diagram to the use case instance (RClick on use case -> New child diagram -> Select composite diagram => doesn't open the window "select a diagram"). How can I do this ?
If the way I did it seems wrong / not a good practice, how could I do it better ?
To create (and link) activities for a use case Add/Activity/with AD from the project explorer for the UC. That will create it inside the UC where it belongs. item
You'd be better served with a simple profile that creates the TVs automatically. See here: http://community.sparxsystems.com/tutorials/552-24intro-to-creating-a-mdg-file