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
16
No. If you just delete the package by SQL you will miss its elements. Only delete a package via API.

You can create and delete a package in the same run. So probably you're doing something wrong somewhere :-\

q.

The package that I am deleting is not empty (has some other packages inside it), though that should not be a problem..

I have tried over the weekend to see what could be the problem, sure that using the API to delete a package is the best way, but looping through all packages/elements of the model to find a package with a specific name can and will take a lot of time.  Maybe it would be an option to delete all the packages that have ParentID the package that I want to delete?

I initially thought that the fact that I had set:
Code: [Select]
  Repository.EnableUIUpdates = false;
was the problem, but it seems not.

Will keep digging, thanks.

17
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

18
Thanks, I have used the suggestions, but the package is still not deleted. Could the problem be that I create and delete the package in the same run of the script? (JScript)

I might simply use the SQL solution where I delete the package by name, can I safely do this?

19
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();
}
}
}

20
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)



21
Thank you for the reply.  I noticed there is some RTF markup that I could use, but how to actually insert it using DocumentGenerator I have not figured it out , as DocumentGenerator just considers it as text using InsertText ...

What would you suggest instead of DocumentGenerator?

Thanks.

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


23
I understand, thanks. That would be a nice functionality in the future  :)

24
Happy new year!

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

25
General Board / Re: Programatically lock requirements
« on: September 08, 2015, 01:03:04 am »
Thank you!

26
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!

27
General Board / Re: ReqIF and RIF in EA Architect
« on: September 07, 2015, 11:43:10 pm »
I am also curios of an answer to this, did you find any viable solution ?

28
Bugs and Issues / Re: Special characters in XML
« on: October 06, 2015, 06:19:01 pm »
Quote
You might be lucky if you change the codepage of the text file.

Although I think your source file is probably not valid XML. If I'm not mistaken you have to escape special characters like that in XML.

Geert

Good morning, thanks for everyone's feedback.

Not sure about the escaping of the characters, as there are only 5 characters http://www.w3.org/TR/xml11/#sec-predefined-ent which must be escaped when using XML documents.

Just to add to my previous report: the file is generated from a tool and it should be valid XML

Encoding:

Code: [Select]
<?xml version="1.0" encoding="UTF-8" ?>
I am following the steps from EA tutorial https://www.youtube.com/watch?v=T-guvzhWPnk to debug the XML.

Does EA have an XML library or related functions that I could used instead, maybe directly from a JScript file?

Thanks

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

30
Automation Interface, Add-Ins and Tools / Re: Include XSD file into project
« on: December 01, 2015, 08:28:18 pm »
Sorry for my late reply and thanks for your reply.  But that is not quite what I am trying to do. I am writing a script. This script will then be exported and should be able to run the validation on each machine that I import it to...

So that for the example above there would be:

Code: [Select]
path_file_included_in_Sparx = EA_path + XSD_filename
What I am trying to do is get the
Code: [Select]
EA_path and
Code: [Select]
XSD_filename somehow, is that possible by including it as a resource?

TLDR; XML validation script with XSD schema included as a file using MSXML validator


Pages: 1 [2] 3