Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Michel Gibelli on September 30, 2014, 10:57:29 pm

Title: Filter to exclude Packages from an RTF template
Post by: Michel Gibelli on September 30, 2014, 10:57:29 pm
Hello,

I am trying to buid a Document generation template and I would like to exclude child Packages from the generation (for example packages which do not have a certain stereotype, eg <<myStereo>>).

In the document options, the tab "Element filters" applies only to Element (and not packages).

In the "Document options" tab, there is a textfield 'Except where Query excludes a Package', so I tried to write the custom SQL :
SELECT * FROM t_object where Object_Type = 'Package' and Stereotype <> 'myStereo'
But it did not work. I do not clearly understand the behavior of this field.

Do you have any advice to obtain the result ?
Is it possible or should I change my strategy ?

Thanks in advance
Michel
Title: Re: Filter to exclude Packages from an RTF templat
Post by: Adam@Schneider on December 10, 2014, 04:51:37 pm
I came across this when I was looking for something else. You need to select the package ID from the t_package table, eg:

SELECT Package_ID AS ExcludePackage
FROM t_package
WHERE t_package.Package_ID = #PACKAGEID#
AND t_package.Name in ('Overview', 'Detailed View')

You may need to subselect on the t_object table because a packages also have elements, and the t_object table stores the stereotype.

Have a play in Edit->Find In Project, you can change to the SQL tab and use that to test your query (ctrl+space auto completes table names like intellisense)
Title: Re: Filter to exclude Packages from an RTF templat
Post by: Michel Gibelli on January 13, 2015, 04:13:08 am
One month later  :-[
I would like to thank you.
It helped me.
The reference is in the help (search for "Exclude Package Query and Script")

Michel