Author Topic: VBScript create package with Exclude from Generated Report  (Read 2120 times)

m2i7c9k

  • EA User
  • **
  • Posts: 42
  • Karma: +0/-0
    • View Profile
VBScript create package with Exclude from Generated Report
« on: July 24, 2021, 12:34:01 am »
Hi Guys,

is it possible to create the package by VBScript with "Exclude from Generated Report"?

sub main

   dim i

   dim msg
   dim iBox
   dim appName
   appName = "Package"
   
   dim thePackage as EA.Package
   set thePackage = Repository.GetTreeSelectedPackage()

   dim theElement as EA.Element
   set theElement = Repository.GetTreeSelectedObject()

   dim packages as EA.Collection
   set packages = thePackage.Packages
   
   dim elements as EA.Collection
   set elements = thePackage.Elements

   dim subPackage as EA.Package
   set subPackage = packages.AddNew("[data]", "Class")
        subPackage.what?
   subPackage.Update()
         
         
   Repository.Models.Refresh()
end sub

Thanks for HELP :)

Mick

m2i7c9k

  • EA User
  • **
  • Posts: 42
  • Karma: +0/-0
    • View Profile
Re: VBScript create package with Exclude from Generated Report
« Reply #1 on: July 24, 2021, 01:43:12 am »
OK I got it :)

option explicit

!INC Local Scripts.EAConstants-VBScript

'
' Script Name: createAnalyticalService Diagram
' Author: Milan Hudec
' Purpose: N/A
' Date: streda, 17 marca 2021, 15:46:45
'
sub main

   dim i

   dim msg
   dim iBox
   dim appName
   appName = "Package"
   
   dim thePackage as EA.Package
   set thePackage = Repository.GetTreeSelectedPackage()

   dim theElement as EA.Element
   set theElement = Repository.GetTreeSelectedObject()

   dim packages as EA.Collection
   set packages = thePackage.Packages
   
   dim elements as EA.Collection
   set elements = thePackage.Elements

   dim subPackage as EA.Package
   set subPackage = packages.AddNew("[data - t]", "Class")
   subPackage.Update()
   
   dim theNewPackage as EA.Element
   set theNewPackage = Repository.GetTreeSelectedObject()
   theNewPackage.update()
   Session.Output  ( theNewPackage.PackageID & " - " & theNewPackage.name )
   
   dim updatequery
   updatequery = "UPDATE t_package SET PackageFlags = 'RTF=F;' WHERE t_package.Package_ID = " & subPackage.PackageID
   Repository.Execute updatequery

   Repository.Models.Refresh()
end sub

main
« Last Edit: July 24, 2021, 02:15:40 am by m2i7c9k »