How to Save Time Automating Repetitive Tasks in Enterprise Studio


Subscribe
Boudewijn Meyboom
Posted by Boudewijn Meyboom on Jun 10, 2015

BiZZdesign Enterprise Studio

With the release of Enterprise Studio, the BiZZdesign tools have become a lot more powerful in automating and scheduling tasks. For a long time now, the BiZZdesign products have had the ability to run analyses and to automate repetitive tasks. This is done by using our own scripting language, which is specifically adapted to a working with (architecture) models.

Using this scripting language it is possible to automate tasks such as importing data from external sources, synchronizing with systems or models, and reporting model contents. By automating the reporting of a model, you can make sure that the information available to the rest of the organization is always the information from the latest model.

Why use automation in Enterprise Studio?

Because a report may take some time to generate, users often choose to do this only when necessary, but by scheduling the task it can be done nightly or at whatever interval is convenient. This leaves you with more time to spend on working with your organization to design and implement change. Examples of tasks you may want to schedule on a regular basis:

  • A nightly save of the current state of the model
  • A periodical report of the model contents, only publishing those sections that are ready to be published
  • Synchronizing the contents of your CMDB with the contents of your infrastructure and application model
  • Synchronizing between your business process models and architecture model

How to use automation in Enterprise Studio?

Schedule tasks is done by starting Enterprise Studio with a specific parameter. This parameter contains the task that will be performed. Scheduling the task uses very simple functionality that is already built into any Windows machine: the task scheduler.

windows-task-scheduler

See Microsoft’s own excellent explanation of all the possibilities of Task Scheduler here.

Using the Task Scheduler we can start Enterprise Studio at any time with the correct parameters. As mentioned before, with these parameters we can define which actions are taken. I will give you an example of generating an InSite Lite report automatically. I will not go into detail on how to schedule this, Microsoft explains it elaborately already. Alternatively your friendly systems administrator can help you with it.

Basic example of an automated task

Automating the task is done by adding a parameter to a shortcut. Adding this parameter means that the defined task is performed and the tool is closed afterwards. In this case we’re copying the shortcut into Enterprise Studio to make a special automated shortcut by adding this line to it:

[sourcecode]

-script=”C:\Temp\runonstartup.txt”

[/sourcecode]

bizzdesign-architect-4-7-0-properties

The contents of this file are these lines of script – this is a very basic example that just shows you how to run Enterprise Studio, we will expand on the reporting options later.

Example script basic:

[sourcecode]

//DEFINE THE LOCATIONS WHERE EACH FILE IS SAVED TO OR OPENED FROM:

//the logfile of the run:

parameter "logfile" "C:\\Temp\\ArchitectRunLog.log";

 

//location of your modelpackage

PkgLocation = "C:\\Temp\\Archisurance.xma";

 

//open the modelpackage and output the name of each model in it:

package = InternalObject("client").openPackage(PkgLocation);

 

forall "MM_Model" modl in package {

     output modl;

}

[/sourcecode]

This is a basic automatic function: it writes the name of each model in the modelpackage to the logfile.

Take note:

  • the location of the modelpackage must be set in this file
  • File locations must have a double backslash \\ instead of a single slash
  • You will see Enterprise Studio opening briefly do not work in this instance of the tool
  • You must have write rights for the location where the log is saved and read rights for the modelpackage location

How do I automatically generate a report?

Next we will look into generating an InSite report from a modelpackage.

Use this script:

[sourcecode]

//DEFINE THE LOCATIONS WHERE EACH FILE IS SAVED TO OR OPENED FROM:

//the logfile of the run:

parameter "logfile" "C:\\Temp\\ArchitectRunLog.log";

 

//location of your modelpackage

PkgLocation = "C:\\Temp\\Archisurance.xma";

 

// The folder in which the report must be generated:

reportFolder = "C:\\Temp\\Insite";

 

 

//GENERATE INSITE REPORT

package = InternalObject("client").openPackage(PkgLocation);

job (package) {

 

     viewsToReport = undefined;      // this variable defines which views are included in the report, undefined means all views

     viewpointsToReport = undefined; // this variable defines which viewpoints are included in the report, undefined means all label and color viewpoints

     startView = undefined;          // this variable defines which view will be the starting view, undefined means a view marked as default view will be used

 

     // Names of the profile attributes that should be left out of the report:

     attributesToSkip = Set();

 

     // Names of the profiles that should be left out of the report:

     profilesToSkip = Set();

 

     // The language of the model texts used in the report:

     reportLanguage = "en";

 

     // The folder that contains the view page template:

     templatesFolder = "C:\\Program Files (x86)\\BiZZdesign\\Architect 4.7.0\\\\data\\InsiteReporter\\templates";

 

     // Generate the report:

     path = InSiteLite:generateReport( viewsToReport, viewpointsToReport, attributesToSkip, profilesToSkip, reportLanguage, reportFolder, templatesFolder, startView );

 

     // Open the report:

     if ( !path.isUndefined() ) {

          client = InternalObject("client");

          if ( !client.isUndefined() ) {

                client.fileIO().openFile( path );

          }

     }

}

output "Run completed";

[/sourcecode]

When Enterprise Studio is started up with this script it generates an InSite Lite report for the specified model, and places it in the specified location.

InsiteFrontpage

Save this to the same file runonstartup.txt and run Enterprise Studio, it will now run the report when you click the hyperlink. By using Task scheduler to start this specific hyperlink you can run this automatically at night.

Some things to take into consideration

There are a few notes on this way of automatically generating an InSite report:

  • The entire modelpackage is reported (this may take a while for large modelpackages)
  • One of the views marked as ‘default view’ is used as the start view for the report, if there is no default view, a random view will be used
  • You must have write rights to the location where the report is saved
  • Any existing reports in that location will be overwritten

What parts of the modelpackage are reported and what the default view will be can also be defined in this script.

It is possible to automate and schedule all functionality in BiZZdesign Enterprise Studio. You can do this yourself, using the scripting resources in the Help overview of the tool. If you'd like to read more about scripting, let me know in the comments and I'd be happy to help you or dedicate a whole new blog to it. 

BiZZdesign-Enterprise-Studio-CTA

SUBSCRIBE TO BIZZDESIGN'S BLOG

Join 10.000+ others! Get BiZZdesign's latest articles straight
to your inbox. Enter your email address below:

 

Subscribe to Email Updates

comments powered by Disqus