Batch File Reporting in Cradle

Publishing Reports

Do you want to run your reports faster or wish you could run them overnight or at weekends so they are ready when you arrive at work in the morning? With batch file reports, you can do this quickly and easily.

What is a Batch File?

A batch file contains a series of DOS commands, and is commonly written to automate frequently performed tasks including publishing reports and documents. Instead of typing the same commands over and over in a Command Prompt, you can simply double-click the batch file or use Windows Task Scheduler to set it running during down times e.g. over night or weekends which then creates all the reports you require.

The following report will show you how to create a batch file for these reports.

How to Write a Batch File for Reporting

Using a plain text application like Notepad, you need to first set the folder the application to be used is in. In this case, it is in the same place all Cradle applications are held, the command does need to be surrounded by quotes

“%CRADLEHOME%\bin\exe\windows\c_table.exe”

You then need the login information to the project that you would normally would when using a Command Prompt.

-login admin,ADMIN,demo or -login reqman,REQMAN,demo

After these 2 necessary parts, you need the options for the report; you can find these options in our online Help System for c_table. If you are already in the Command Prompt in the correct location then just type in c_table and you will see the Information popup.

Information on command options for c_table to use in batch file reporting
C_Table Command Options

Once you have finished writing you batch file, the command should look something like this:

"%CRADLEHOME%\bin\exe\windows\c_table.exe" -login reqman,REQMAN,demo -file "C:\Temp\Project_Setup_Demo.rtf" -report Project_Setup -rloc project -format rtf

You can use c_table to publish data from a matrix:

"%CRADLEHOME%\bin\exe\windows\c_table.exe" -login reqman,REQMAN,demo -file "C:\Temp\Coverage.htm" -matrix "Requirement Coverage" -mloc project -format html

Metrics can be published in the same way:

"%CRADLEHOME%\bin\exe\windows\c_table.exe" -login reqman,REQMAN,demo -file "C:\Temp\Project Analysis.htm" -metric "Project Analysis" -metloc project -format html

Graphs can be displayed in html, rtf or svg

"%CRADLEHOME%\bin\exe\windows\c_table.exe" -login reqman,REQMAN,demo -file "C:\TempVerified Requirements.htm" -graph "Verified requirements" -gloc project -gprint batch -gprloc project -format html

You can publish queries using different views:

"%CRADLEHOME%\bin\exe\windows\c_table.exe" -login reqman,REQMAN,demo -file "C:\Temp\Requirements All.rtf" -query "Requirements - All" -qloc project -view "Requirement - Complete" -vloc project -format rtf

You can also publish comma separated data into a csv file:

"%CRADLEHOME%\bin\exe\windows\c_table.exe" -login reqman,REQMAN,demo -file "C:\Temp\Requirememts_All.csv" -query "Requirements - All" -qloc project -view "Requirement - Complete" -vloc project -format csv

Remember to put quotes around any options with spaces in them e.g. “Requirements – All”

Save this file using the DOS extension of .bat e.g. batch file reports.bat

How to Run a Batch File for Reports

Running a batch file is simple, as long as all the options in the commands are correct; just double click on the .bat file. You will see a Command Prompt open and as each report finished, the next will begin.

Command prompt with some of the command lines used in the Batch File Reports
Command Lines for Batch File Reporting
Showing some of the reports from the batch files within the set folder. The folder in this case is the Temp folder on the C drive
Reports in the Temp Folder

As you will see running batch file reports is quicker and easier. You can also then add any reports you require to the file. The newly added reports are then also published the next time you run the batch file.

If you wish to use Task Scheduler for out of hour’s usage, you can find information here on the Microsoft website.

You can also use batch files for import and exporting through the c_io, publishing documents through Document Publisher  and converting CSV information into a Cradle import/export file for loading into a Cradle PDB using the CSV Converter Utility.