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

Pages: [1]
1
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.

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

3
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.

Cheers,

4
Hi everyone,

I am using an example from Gert (thanks, Gert, http://sparxsystems.com/forums/smf/index.php/topic,24996.0.html)slighly modified, to obtain all elements that have a certain tagged value.

When I run the query in the Find in Project using SQL Scratch pat, it returns the result, but when I run within the script, a DAO error  (Item not found in this collection  :o :o :o), any ideas why?

tagged value name = objectid
tagged value value = any string
Code: [Select]

var sql = "select c.ea_guid as CLASSGUID,c.object_type as CLASSTYPE,c.name as Name, c.stereotype as Stereotype ,package.name as PackageName ,package_p1.name as PackageLevel1,package_p2.name as PackageLevel2,package_p3.name as PackageLevel3"+
" FROM  (((((t_object c  " +
" INNER JOIN t_objectproperties op on op.Object_ID = c.Object_ID)  " +
" INNER JOIN t_package as package on c.package_id = package.package_id)  " +
" LEFT JOIN t_package as package_p1 on package_p1.package_id = package.parent_id)  " +
" LEFT JOIN t_package as package_p2 on package_p2.package_id = package_p1.parent_id)  " +
" LEFT JOIN t_package as package_p3 on package_p3.package_id = package_p2.parent_id)  " +       
" WHERE op.Property ='objectid' AND op.Value like '"+ flag_objectid +"'";

var els as EA.Collection;
els = GetElementSet(sql, 2);


After I inspect the SQL query & copy paste it into the SQL Scratch pad, it works correctly but not in the JScript  :o

5
Hello,

I have a very simple function to delete packages from a parent package, given the name of the package I want to delete, however, it does not work at all times (eg it does not delete the folders given as name ).  Any ideas why?

Example:

Input

-parent
--mypackage
--mypackage
----subpackge_of_my_package
--another subpackage

Output (expected)
-parent
--another subpackage

This is the function:

Code: [Select]
parent = parent folder ( given )
packageName = package name of the folders to be deleted (given)

Code: [Select]
//deletes a package with the reference to the package given
function deleteFolderIfExists( parent, packageName) {
var pkgList as EA.Collection;
pkgList = parent.Packages;

for (var i = 0; i < pkgList.Count; i++) {
var p as EA.Package;
p = pkgList.GetAt(i);

if (p.Name == packageName) {
pkgList.Delete(i);
pkgList.Refresh();
parent.Update();
}
}
}

6
Bugs and Issues / DocumentGenerator NewDocument ignores the template
« on: July 13, 2016, 10:36:15 pm »
Sparx version: 12.0.1214
Problem:DocumentGenerator doesn't seem to be able to generate a document based on a template.
Reproduce:

Code: [Select]
    var Gentor as EA.DocumentGenerator;
    Gentor = Repository.CreateDocumentGenerator();
    Gentor.NewDocument("custom-reporting");   
where custom-reporting is a template saved in User Templates / Templates

However, 
Code: [Select]
Gentor.insertTemplate("custom-reporting") works OK but will obviously insert a template and NOT generate the whole document based on a template (eg no page numbering etc)



7
Hi all,

I have successfully created an RTF file using DocumentGenerator and easily inserting text with the InsertText method.

How can I add a table (with say 3 columns and 5 rows)?

Any input is appreciated.


8
Happy new year!

How can I collapse a branch programatically from the script ? (e.g. not right clicking on Package -> Collapse Branch)

9
General Board / Programatically lock requirements
« on: September 07, 2015, 11:41:49 pm »
Hi, I am very new to EA and help would be appreciated. I've already written a few script thogh.

Would it be possible to programmatically lock (e.g. by running a script) all the elements that are requirements? In all the diagrams, for all models, in all packages?

Thanks!

10
Bugs and Issues / Special characters in XML
« on: October 06, 2015, 01:05:45 am »
When opening an XML file with Enterprise Architect, if the file has special characters, the characters are not displayed. Instead, illegal characters are displayed, e.g. möglich

This does not happen if you type in the text or if you copy/paste the text.

Is there a workaround for this?

11
Automation Interface, Add-Ins and Tools / Include XSD file into project
« on: November 25, 2015, 02:02:44 am »
Hi,

I want to include an XSD file into the project, so that I can verify an XML file by applying the schema. The return path should be the full path to the XSD file that is included in the project.

Sample code:

Code: [Select]
try {
  xs.add("urn:books", "path_file_included_in_Sparx.xsd");
  xd.schemas = xs;
  xd.async = false;
  xd.validateOnParse = false;
 }

where path_file_included_in_Sparx should be the path to the file included in Sparx.

Is there a way that I can do this in SPARX? :-?

12
Automation Interface, Add-Ins and Tools / Element marker in tree view
« on: November 10, 2015, 09:17:39 pm »
Hi,

Sparx offers a nice visual detail in the TreeView, after connecting with an external solution, for example C#


Would it be possible to add the same type of marker (an image at the corner) for an element?

Also, in the diagrams, I know it is possible to change the color of an element, by defining a stereotype and altering color, but is it possible to add an image at the corner, for an existing element?

What I am looking for is a way to define an image file that will display at the corner of elements in the treeview and in the diagrams.

Looking forward to your answers.

13
Automation Interface, Add-Ins and Tools / Date format in element
« on: November 06, 2015, 08:30:25 pm »
Hi,

(JScript) I want to programatically add the created date to an element.

Code: [Select]
var currentDate = new Date();
element.Created = currentDate ;

triggers Typeconflict.

currentDate has the value
Code: [Select]
Fri Nov 6 10:28:20 UTC+0100 2015
in which format should the date be such that I can insert it into the element?

Pages: [1]