Easy Ways to Benefit from Automating Monarch

by Sandy on December 21, 2009

in General / Tips

When you read the word “computerization”, do you think of what can be done with software or do you think of the ways that computers can automate many of our tasks?

The first Industrial Revolution began in the 18th century, and from that time until about the middle of the 20th century, and during that period we learned how to build and employ machines to facilitate our lives. Over the first 20 days of the 30 Days to Become a Better Monarch Modeler series, we’ve in effect looked at how to build a machine that extracts data from confined sources such as reports into data structures of our own design as a part of the process of converting data into information and knowledge.

But we know that the Industrial Age gave way to the Information Age, or the Computerization Age, so when build a data extraction machine, why do most of us stop in the old Industrial Age instead of adapting the machine to work in the Computerization Age?

Today on day 21 of the 30 Days to Become a Better Monarch Modeler series, we’ll look at some easy to implement ways to automate our model machines.

Automation Method 1: Project Files

The first automation method that Monarch offers is called a project file. Project files are a single file that eliminates the work of first opening a data source, and then opening a model file. When you save a project file, the paths (drive and folder information) and the file names for both the data source and the model that must be used for that data source are stored for later use. So when we open a project file, Monarch does some basic work for us; the roots of automation.

On day 17, we reviewed the many options available for exporting data from Monarch. By employing project files, we can define reusable exports using a special device known as a “project export”. Using project exports, we can avoid duplicating the work, however minimal it might be, of stepping through the export wizard that we used on day 17.

To create a project export we also step through a wizard interface, but at the outset we supply a name to uniquely define a particular export. This will be a critical part of later, more advanced automation, because we can choose to instruct Monarch run particular exports from within a larger set.

Imagine a model built to extract from a report file. In this model, we’ve built three summaries. On the first day of each week, we need to export only the first two summaries. On the last day of each fiscal period, we need to export a PDF file from the Report window, the entire unfiltered contents of the Table window to a table in an Access database, and all three defined summaries. To handle this differing work, we would create two project files; each one with project exports included for its requirement.

Automation Method 2: Batch Files and Script Files

Batch files (or command files) are usually short – maybe as little as a single line – text files that contain commands to send to the operating system. In our case, they’d be used to tell Windows to start Monarch and send it some additional instructions, like open a particular report and immediately apply a model and then export the data to a file.

Monarch has wisely been programmed so that we can give it a kind of “remote control” direction, using what are known as command line parameters. The full description of these directives is available in the online help documentation. Look up “command lines” on the Index tab of the help.

There are quite a number of available instructions. Some are only available to Monarch Pro users, and some are only available for later versions of Monarch software.

Even with the online documentation available, many Monarch users find the process of building batch files to automate Monarch challenging, so some time ago I developed a Monarch Batch File Generator to assist.

An important point relating to batch files and project files in particular is that while project files tie a data source, such as a report, and a model together “permanently”, we can use a project file (to take advantage of the defined project exports) but replace the default data source with a new one using only a single command line parameter. So don’t think that you’re locked into using the pre-defined report filename that defined as a de facto report for a project file.

Another option available to the moderately adventurous is the Windows Visual Basic Script (VBS) route. One could argue that certain types of automation solutions could be developed more easily with VBS than with batch file development.

Multi-Pass Solutions

Batch files can be the easiest way to implement multi-pass solutions, wherein more than a single Monarch extraction might need to be performed before the desired goal is achieved. Moreover, some processes absolutely rely on multiple extractions in order to generate accurate and up to date data.

This might be the case for models that employ external lookups. The first steps might involve generating the data to be used for the lookup tables themselves, and then employing those tables to generate and export summaries, and finally using each of those summaries as an input for yet more Monarch models.

When running Monarch processes sequentially in a batch files, it’s best to precede each line with the START keyword, followed by a title for the process (in double quotes) and a /WAIT parameter. This will ensure the Monarch will complete entirely before the batch file proceeds with the next command. You could wind up with poor data if your batch file doesn’t /WAIT properly.

Your Task for Today

Today your homework involves creating precisely three new project files and defining project exports to become accustomed to how you can save yourself the repetitive work that can be encountered when regularly using Monarch.

Be careful to set the file handling options properly when creating project exports, as you’ll get exactly and only what you asked for.

Next, create a single batch file that will run all three project files for you. Define the batch file to operate as follows:

  • The first project file will export only all of the defined project exports
  • The second project file will not only export but a single export from a project file which has multiple project exports defined, but will also export the table window data, overwriting a file if necessary to do so
  • The third project file will export only the table window data, and will append that data to an existing file

What Will You Build Today?

Knowing how you can take advantage of automation methods that are simple and easy to implement and readily available can shape how you build both your models and the overall solutions for which they’re developed. By familiarizing yourself with some of the basic ways to work in the Computerization Age instead of the old Industrial Age, you’re becoming a better Monarch modeler.

Keep automation in mind and you’ll excel with Monarch.

Continue your commitment to Become a Better Monarch Modeler with Part 22 of the series, or review Part 20.

Leave a Comment

*

Previous post:

Next post:

Copyright © 2007 - 2012 Excel with Monarch Training and Services. All rights reserved. Privacy Policy
Microsoft Excel™ Microsoft Corporation. Monarch and Monarch Pro™ Datawatch Corporation.