Tuesday, May 5, 2015

Scheduling Doc xPress with a SQL Agent Job

Since I work for Pragmatic Works, I use Doc xPress a lot (and you should, too!). One of the many handy features is the ability to run snapshots through as a scheduled job. There are two different ways to do this; as a SQL job, or a scheduled task. This post will serve as a tutorial for setting up a SQL job.

The first thing that must be done is the creation of a snapshot request file. In a Doc xPress solution, you will see a the option to create one in the lower right corner. The snapshot request file is an XML file that contains all the information about the Doc xPress solution.











You will also see an option to create a documentation request file, used for automating the documentation process. Click the snapshot request file button. Browse to a location in which to store the file and give it a different name, if desired. In this example, I am renaming the file as the same name as the solution and storing the file in a folder on my C: drive.















Now that the file has been created, the job needs to be created next. Open SSMS and make sure the SQL Server Agent is running. Right click 'Jobs' and select 'New Job'. Name the job and don't worry about a category. It isn't needed here. Who likes being pigeon holed into groups anyway?






















To the left of the window, select 'Steps'. Click the button at the bottom of the window that reads 'New'. Give the step a name, and then, under the 'Type' drop down menu, select 'Operating system (CmdExec)'. Next, add the command. There are two parts that are needed; the path to Docxpress.exe, and the path to the request file. When using the default installation directory of Doc xPress and the path to the file that was just created, the command  will look like this (including the quotes!)...

"C:\Program Files (x86)\Pragmatic Works\Pragmatic Workbench\Docxpress.exe" "C:\Snapshots\LocalEnvironment.xml"

Now, I can't stress this enough, be sure to include the quotes as seen in the command above.

The finished step should look something like this...






















Click OK. Before I set up a schedule, I want to run the job and be sure it works. Click OK to save the job. In the Object Explorer in SSMS, right click the job and select 'Start job at step'. This will run the job and create a new snapshot for the Doc xPress solution. Once it runs successfully, then it can be scheduled. This way, I can automate my late night snapshots so I have time to do other things.

Again, this is just one way of scheduling. I will follow up with another post showing this same process with the Windows Task Scheduler.


0 comments:

Post a Comment