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.


Topics - DeBAAT

Pages: [1]
1
For a project, I'm trying to export some information to an Excel file using a JavaScript.
Most of the code now seems to work.
Except for creating a new Excel file on the location I want it.
Export works fine when I open an existing file.
Saving a newly created Excel file also works, it only refuses to write it to the strExcelFileName I specified using GetFileNameDialog().
When I close the newly generated Excel workbook, it saves it as "Map1.xlsx" in the default folder used by the Excel application.

The code below shows what I have used for testing (after cleaning up a bit).
Hope to get some pointers on how to fix this.
Thanks!

Code: [Select]
let objExcelWorkBook = null;
let objExcelApplication = null;

// Start the Excel Application as COMObject
objExcelApplication = new COMObject( "Excel.Application", true );

// Get the strExcelFileName to get the information from
projectInterface = Repository.GetProjectInterface();
strExcelFileName = projectInterface.GetFileNameDialog( strExcelFileName, FilterString, Filterindex, Flags, InitialDirectory, OpenorSave );

// Get objExcelWorkBook from the strExcelFileName provided
objExcelWorkBook = objExcelApplication.Workbooks.Open( strExcelFileName );
if ( objExcelWorkBook != null ) {
// objExcelWorkBook FOUND
Session.Output("EXCELWOpenWorkbook found Workbook with strExcelFileName = " + strExcelFileName + " !" );
} else {

// If the objExcelWorkBook file does not exist, then create one
objExcelWorkBook = objExcelApplication.Workbooks.Add();
if ( objExcelWorkBook != null ) {
// If the file added ok, then save it with new name
objExcelWorkBook.SaveAs( strExcelFileName );
} else {
LOGError( "EXCELWOpenWorkbook could NOT open nor add strExcelFileName " + strExcelFileName + "!" );
}
}

// Close and save the previously opened or created objExcelWorkBook
objExcelApplication.Workbooks.Close();

2
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:

Code: [Select]
!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();

3
PCS General Board / WebEA with Dynamics and - or Scripts
« on: July 31, 2023, 09:50:03 pm »
As a team, we are using WebEA to share EA Repository information with the rest of the organisation.
This works rather well, even using Legends to provide insight into the various settings defined in TaggedValues like Platform which is an indication for an Application whether it is implemented OnPremise, Cloud or WorkStation.

Now I'm wondering whether WebEA is really static or capable of handling some dynamics.
What I mean is that WebEA is showing diagram images 'automatically' generated when the diagram is modified and stored.
Now, when I change the TaggedValue of an element, in EA it directly shows on the diagram with that legend.
There is however no '*' indicating that the diagram is modified and  thus it will not be rerendered and stored.

Is there any option to define some script or something else (Button?) to enable the users of WebEA to re-render the diagram image?
If so, would these users then need some specific authorisations to allow them to use that option?

4
For a project I'm working on, I'm trying to display EA images in a PHP web application.
So far, I've located the information in the t_document table, as also indicated in the post "https://sparxsystems.com/forums/smf/index.php/topic,47559.msg277179.html".
The images are also automatically generated with the cloud option as they show in WebEA.

Unfortunately, I cannot decode the string I find in the StrContent column of t_document to show on my PHP page.
It seems to be some string that would render as "image/png" but it doesn't show the image.
Decoding base64 doesn't help either.

Any suggestions are highly appreciated.

5
PCS General Board / Release token for WebEA
« on: February 03, 2023, 07:27:33 pm »
As we are still somewhat struggling with the installation of WebEA, I was wondering whether it was possible to release a token which has been allocated to a process that crashed or to a user who hasn't logged out properly.
At the moment we need to wait half an hour each time all tokens are used (we don't have many right now).
Any suggestions?

6
Bugs and Issues / Publish to Joomla with ODBC using 32 or 64 bits?
« on: November 29, 2022, 12:18:33 am »
Hai all,
At the moment, I'm getting a bit confused with all the possible combinations that are possible when mixing 32 and 64 bit applications and addons.

For this particular use case, I would like to publish a model to a Joomla site running in a local Laragon environment with a 64 bit MySQL database.
I installed separately an ODBC driver for MySQL which was not yet included on my machine. It comes with both a 32 and 64 version. I tried both options to no avail.
When I only have the 32 bit ODBC driver installed, the ODBC connection can only be managed by the 32 bit EA client (in this case v15.2).
The 64 bit EA client is v16.0.1605.

I managed to get some successful configurations running, including the connection tests and the selection of the Joomla User, as described in the manuals.
Unfortunately I get stuck on the message "Database Connection Error" which causes the EA client to crash.

Any suggestions to solve this are welcome.

Best,
Jan

7
When I copy/paste a diagram as new, I get presented a choice of three options.
The one I want is to make a shallow copy of the elements on the diagram whereby each element is a reference link to the same element defined elsewhere.
This works as expected for all elements on the diagram with the exception of legenda elements.
The legenda element is duplicated and appears as a new element in the package I paste the diagram in.
Any suggestions on how to prevent this?

8
General Board / Running EA15 and EA16 on same computer
« on: May 05, 2022, 02:30:52 am »
With the introduction of EA16, there is the option to migrate an EAPX file to QEAX format, changing the underlying database as also indicated in another topic.
In my case, I would like to run both EA15 and EA16 on my same pc as I use different file repositories for different customers who are not migrating at the same pace.
What would be needed to make this happen?

I already installed the new EA16 on a test machine and it seems to run the out-of-the-box functionality but it looks like I'm missing the add-ons like EAUtils or the Bellekens Tools.
Any suggestions?

9
General Board / How to combine legends on a diagram?
« on: February 03, 2022, 09:42:41 pm »
The use of legends is very powerful to communicate information on a large set of objects.
Sometimes, I would like to combine several values to show on a single element.
E.g. by combining the coloring of multiple legends for different attributes like Status and Department.

Another example would be the information of connector relations.
On a diagram with a number of elements, I would like to assign colors to indicate the relation with other elements.
E.g. an application can be related to one or more dataobjects while the same dataobject could also be related to one or more applications.
In the diagram I would like to show all applications with a color related to the dataobjects such that when a single application is related to three dataobjects, then I would like the application to show the three colors defined in the legend for the corresponding dataobjects.

Would this be possible?
Any suggestions are welcome.

10
General Board / Autocolor legends used flexibly
« on: February 03, 2022, 09:35:33 pm »
The autocolor function of Legends is very useful to show how different elements share the same value, e.g. a status like "Open" or "Closed".
The way to define the colors is to define the color to show for each of the possible values.
This works fine with predefined values like you can use with Status.

However, this works less fine when the value of the related attribute is not easily determined beforehand.
An example of my work now is the name of the ContactPerson as defined for an application.
As soon as the spelling of a name changes or a new value is added, I need to change the definition of the legend.
It would help me very much if it would be possible to have real autocolor as generated by the system.
The way it could work is to pre-define a list of possible colors, determine the list of possible values (dynamically with a query from the database) and assign each value a color from the predefined list, based on the order in the generated list.

Any suggestions on how I could make this myself?

Pages: [1]