30
« on: August 11, 2023, 06:39:48 pm »
In a model I'm working with, there are a large number of TaggedValues. That many (>28K) that they even won't be exported by the Excel tool of Geert Bellekens.
So I was trying to find why there are that many.
Looks like there are a great number of duplicates (>8K), possibly the result of merging different versions of the reference architectures I imported over time.
The deduplication function of the IDEA add-on didn't deduplicate these TaggedValues when removing duplicate elements.
This should be solved in the latest version of IDEA but still, I keep having a lot of duplicate TaggedValues.
So far only an explanation on the situation I'm in.
During the analysis I noticed an issue with the overview of TaggedValue in the Properties window of an element.
It turns out that that window doesn't show duplicate TaggedValues, making it hard to find and delete them.
In this case, a duplicate TaggedValue is defined as duplicate when two Name attributes are the same for the same element. It is not even necessary to have the same Value attribute.
When entering a TaggedValue by hand, the input process just ignores the new value if the Name of the TaggedValue is already present for this element.
Thus not leading to duplicates.
However, when I use the Excel tool, I can rename TaggedValues and thus (unintendedly?) introduce duplicates.
I suppose I could also get this result with scripts or other add-ons changing the value of the Name attribute of a TaggedValue.
I can replicate the issue with the steps outlined below.
I also wrote a script to show all TaggedValues of all elements on the selected diagram (it is a start for a script to remove the duplicates).
But the issue is thus that the duplicate TaggedValues are not shown.
I'm using EA 16.1 build 1626 - 64 bit
Anybody have similar experiences?
Should I enter this as a separate bug?
Or am I doing something wrong?
Steps to replicate the issue:
1. Create a new QEA model
2. Add View (Package Only)
3. Add Diagram (ArchiMate3.1: Application)
4. Add an ApplicationComponent element
5. Add some TaggedValues:
a. TagValue1 Any Value
b. TagValue2 Any Value 2
c. TagValue3 Any Value
c. TagValue4 Any Value 2
6. Tag overview shows TagValue1, TagValue2, TagValue3 and TagValue4
7. Used Excel importer to rename TagValue3 and TagValue4 to TagValue1
8. Tag overview only shows TagValue1 and TagValue2
9. Script shows:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Selected Diagram(DiagramID: 1) Name= TaggedValues Issue
Selected diagramObjects.Count: 1
...........................................................................................
curElement(ApplicationComponent)(4) found curTaggedValue.Name= TagValue1, Value= Any Value, PropertyGUID= {05B3A5D8-F1C6-44f8-B480-752EBF44947E}!!!
curElement(ApplicationComponent)(4) found curTaggedValue.Name= TagValue1, Value= Any Value, PropertyGUID= {7BEB3CA7-47DA-4d12-B2FE-35810065ECC9}!!!
curElement(ApplicationComponent)(4) found curTaggedValue.Name= TagValue1, Value= Any Value 2, PropertyGUID= {15B2AC35-7676-4434-A041-3D89D3294EE4}!!!
curElement(ApplicationComponent)(4) found curTaggedValue.Name= TagValue2, Value= Any Value 2, PropertyGUID= {8B7D5D85-8B6A-470f-A73F-915D59A12C72}!!!
===========================================================================================
Script to show TaggedValues in Model:
!INC Local Scripts.EAConstants-JavaScript
/*
* This code has been included from the default Diagram Script template.
*
* For all LegendElements on the selected diagram:
* If TaggedValue filter
* Find all TaggedValues for this Value
* Update t_xref list of properties for this legend
* Refresh Diagram
*
*
* Script Name: CheckTaggedValues
* Author: J de Baat
* Purpose: Show the TaggedValues of all elements occuring on the selected diagram
* Date: 10-08-2023
*/
/*
* Check the TaggedValues of theElement provided as parameter
*/
function CheckTaggedValuesElement( theElement )
{
// Cast theElement to EA.Element so we get intellisense
var curElement as EA.Element;
var curElementTags as EA.Collection;
curElement = theElement;
curElementTags = curElement.TaggedValues;
// List all element tags
for ( var i = 0 ; i < curElementTags.Count ; i++ )
{
var curTaggedValue as EA.TaggedValue;
curTaggedValue = curElementTags.GetAt( i );
Session.Output("curElement(" + curElement.Name + ")(" + curElementTags.Count + ") found curTaggedValue.Name= " + curTaggedValue.Name + ", Value= " + curTaggedValue.Value + ", PropertyGUID= " + curTaggedValue.PropertyGUID + "!!!" );
}
}
/*
* Diagram Script main function
*/
function CheckTaggedValues()
{
// Get a reference to the current diagram
var currentDiagram as EA.Diagram;
currentDiagram = Repository.GetCurrentDiagram();
Session.Output("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" );
if ( currentDiagram != null )
{
Session.Output("Selected Diagram(DiagramID: " + currentDiagram.DiagramID + ") Name= " + currentDiagram.Name );
// Get a reference to any selected connector/objects
var diagramObjects as EA.Collection;
var currentElement as EA.Element;
diagramObjects = currentDiagram.DiagramObjects;
// Check whether this diagram has any objects in it
if ( diagramObjects.Count > 0 )
{
Session.Output("Selected diagramObjects.Count: " + diagramObjects.Count );
// One or more diagram objects are selected
for ( var i = 0 ; i < diagramObjects.Count ; i++ )
{
Session.Output("..........................................................................................." );
// Process the currentDiagramElement
var currentDiagramElement as EA.Element;
var currentElement as EA.Element;
currentDiagramElement = diagramObjects.GetAt( i );
currentElement = Repository.GetElementByID( currentDiagramElement.ElementID );
// Check the TaggedValues of the currentElement
CheckTaggedValuesElement( currentElement );
}
// Reload diagram when all processing is done
Repository.ReloadDiagram( currentDiagram.DiagramID );
}
else
{
// No objects on this diagram
Session.Output("No objects on this diagram" );
}
}
else
{
Session.Prompt( "This script requires a diagram to be visible.", promptOK)
}
Session.Output("===========================================================================================" );
}
CheckTaggedValues();