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

Pages: [1] 2 3
1. Select Package
2. Right Click -> Add  Element ...
3. New Element window appears. Input a stereotype name longer that 19 chars. Stereotype name is truncated.
Result -> Stereotype Name limited to 19 characters.

Automation Interface, Add-Ins and Tools / Re: RunReport from script
« on: January 06, 2017, 12:56:24 am »
Yes the snippet works, putting it out there for anyone who might have the same problem.

This SQL gets all elements from the selected package, for example in the  Project Browser  ( currentSelectedElement  ) which have the tagged value TAGGED_VALUE. You can remove this option to search in the whole model. Assumes no package hierarchy eg elements in the packages in packages.. but only the root elements

Code: [Select]
function getElementsFromSelectedPackageSQL(currentSelectedElement) {

if ( (currentSelectedElement == null) || (typeof currentSelectedElement == 'undefined') )
return null;

//get all the root elements from the currentSelectedElement that:
// - have a tagged value TAGGED_VALUE

    var sql = "SELECT obj.Object_ID  " +
        "FROM (( t_object obj " +
        "INNER JOIN t_objectproperties op on op.Object_ID = obj.Object_ID ) " +
        "LEFT JOIN t_package pck1 on obj.Package_ID = pck1.Package_ID     )  " +
        "WHERE op.Property='" + TAGGED_VALUE +
        "'AND ( obj.Package_ID = " + currentSelectedElement.PackageID + " ) ";

    var elementCollection;

    try {
        elementCollection = GetElementSet(sql, 2);
    } catch (ex) {
        LOGError("SQL I/O LOGError" + ex.description);
        return null;

    return elementCollection;

Automation Interface, Add-Ins and Tools / Re: RunReport from script
« on: January 05, 2017, 08:39:24 pm »
It helps if you read the explanation in the manual.
Simply guessing and throwing random stuff at the operations usually doesn't work.


Probabilistic programming and it can sometimes work , especially when the documentation is ambigous ;)

so, here's the deal:

- assume a package, that does not have the stereotype MasterDocument
- you want to RunReport on that package, from a script

Select the package in the Project Browser Window   

then in your script add:

Code: [Select]
var currentProject = Repository.GetProjectInterface; //gets current project
var id = currentSelectedElement.PackageGUID; //gets currently selected package GUID
currentProject.RunReport(id, "Your_Custom_Template_Name", "C:\\exports\\1.rtf");

where Your_Custom_Template_Name is saved in Resources/User Templates

This works.

Automation Interface, Add-Ins and Tools / Re: RunReport from script
« on: January 05, 2017, 03:32:55 am »
Code: [Select]
        var prj = Repository.GetProjectInterface();
        var id = Repository.ProjectGUID;
var xmlID = prj.GUIDtoXML(id);

prj.RunReport(xmlID , "test","C:\\diagram_export\\3.rtf");
Thanks. Tried it, still not working. Everything that I put as arguments is simply ignored - the document generation window triggers with a totally different template name and path.  :o :o :o

Additional Info.

I was able to get an output from the RunReport() method.

But the RunHTMLReport() method does not work.

Mind to share how you did the RunReport() ?

Automation Interface, Add-Ins and Tools / RunReport from script
« on: January 05, 2017, 01:48:43 am »
This code does NOT >:(  work:

Code: [Select]
var prj = Repository.GetProjectInterface();
prj.RunReport("{GUID}", "test","C:\\diagram_export\\3.rtf");

where test is a template in User Templates

I simply have hardcoded something in the "test" file and I want to export it into a rtf. Ideas why it is not working?

Automation Interface, Add-Ins and Tools / Re: Hybrid Scripting
« on: November 03, 2016, 10:15:00 pm »
Maybe you could detail on what do you mean by Hybrid?

Still seems that the question hasn't been answered. Is it possible to include external libraries or not?

Bugs and Issues / Re: Text disappeared in the diagram
« on: September 21, 2016, 10:23:49 pm »
Right click on Diagram
Code: [Select]
-> Properties -> Elements and check
Code: [Select]
Attributes , Operations, Package Contents.

Bugs and Issues / Re: CSV Import
« on: September 21, 2016, 10:19:44 pm »
I am experiencing issues with importing requirement data within an Excel formatted CSV file into Enterprise Architect. I am receiving errors and I am certain where my imported data is after import. I have done this before using IBM DOORS.

You need to make sure that your fields map the predefined accepted fields by SPARX EA

Code: [Select]
Name Type Notes Phase Priority Stereotype Author Alias Status Version Language Scope Complexity Keywords Is Abstract Is Leaf Is Root Is Specification Created Date Modified Date Requirement Difficulty Requirement Priority GenFile Profile Metatype CSV_KEY CSV_PARENT_KEY
Code: [Select]

Automation Interface, Add-Ins and Tools / Automate chart generation
« on: September 21, 2016, 06:49:30 pm »
General question: is it possible to automate chart generation using a script within EA? (Javascript/JScript) (not looking for external tool or similar) If yes, what is a conceptual way to realize it?

What I am looking for:
  • exporting the result of an SQL query as a chart into an Excel file
  • creating pie chart or bar chart of the elements in a folder

In a way that is done here by drag and dropping folder elements into a new diagram.


Bugs and Issues / Re: Charts not working, just black box
« on: September 20, 2016, 09:43:28 pm »
I would like to generate charts also, can you please tell me what example you use and why it does not work?

Thanks, q, starting from your pointers, I managed to get it to work. Writing the solution here, maybe it will  help other people.

Code: [Select]
var query = "SELECT Package_ID FROM t_package WHERE name LIKE '"+ packageName +"'";
var queryResult = Repository.SQLQuery (query);
var columnName = "Package_ID";
var stringValue;

if ( queryResult.length > 0 )
var resultDOM = XMLParseXML( queryResult );
if ( resultDOM )
stringValue = XMLGetNodeText( resultDOM, "//EADATA//Dataset_0//Data//Row//" + columnName + "[0]" );

if (stringValue)
var deleteQuery = "DELETE FROM t_package WHERE Package_ID ="+stringValue;

try { Repository.Execute(deleteQuery); }

Because GetElementSet is looking for a column called Object_ID, which is not in your query.

Code: [Select]
var sql = "select c.Object_ID "+
in the query, solved the problem.

Thank you!

Pages: [1] 2 3