Exclude Package Query and Script

On the Document Options dialog (Template Editor) or Options tab (Document Generator) you can enter a custom SQL Query or select a custom Script to tailor the report in a specific way. One possibility is to exclude the selected Package or a child Package from the report. You can base your Query or script on the examples provided here.

The two parameters you use in excluding a Package are:

·#PACKAGEID# - the Package_ID of the current record in t_package being processed on the exclusion condition
·#OBJECTID# - the Object_ID of the current Package element record in t_object being processed on the exclusion condition

Custom SQL Query

To exclude the Package from the report using a Custom SQL Query, you can create the Query based on the t_package columns. For example:


SELECT Package_ID AS ExcludePackage FROM t_package WHERE Package_ID = #PACKAGEID# and Name = 'Test'



Alternatively, you can create the Query based on the Package object columns in the t_object table:


SELECT t_package.Package_ID AS ExcludePackage FROM t_package,t_object




t_package.Package_ID = #PACKAGEID#




t_object.Object_ID =#OBJECTID#




t_object.Stereotype = 'NoDoc'



Custom Script

If you have selected the Custom Script option and want to exclude the Package from thereport, you can create a script and enter a call to it, such as:





This is a sample of the XML returned by the script:

<?xml version="1.0"?>

 <EADATA version="1.0" exporter="Enterprise Architect">













This is an example of JScript for excluding the Package:


!INC Local Scripts.EAConstants-JScript




* Script Name: RTF Exclude Packages Script Sample




function ExcludePackage(packageID)



var xmlDOM = new ActiveXObject( "MSXML2.DOMDocument.4.0" );


xmlDOM.validateOnParse = false;


xmlDOM.async = false;


var node = xmlDOM.createProcessingInstruction("xml", "version='1.0' encoding='ISO-8859-1'");



var xmlRoot = xmlDOM.createElement( "EADATA" );



var xmlDataSet = xmlDOM.createElement( "Dataset_0" );



var xmlData = xmlDOM.createElement( "Data" );



var xmlRow = xmlDOM.createElement( "Row" );



var package as EA.Package;

package = Repository.GetPackageByID(packageID)


if(package.StereotypeEx == "NoDoc")


 var xmlName = xmlDOM.createElement( "ExcludePackage" );


 xmlName.text = "" + package.PackageID;





return xmlDOM.xml;




Learn more