3: Exposing the .mrs script parameters
'===============================================================
' Parameter Definition Help:
' 1. ?? - Input parameters definition
' 2. @@ - Output variables definition
' 3. $$ - Output files definition
'===========================================================================================
' <PARAM_NAME> <TYPE> <DEFAULT_VALUE> <DESCRIPTION>
'--------------------+--------+------------------------------+------------------------------
'?? REPORT_TITLE MDD "Test Report" "Report title"
'?? INPUT_METADATA MDD "\\server\share\person.mdd" "Input person metadata file"
'?? INPUT_CASEDATA DDF "\\server\share\person.ddf" "Input person casedata file"
'@@ COMPLETION_CODE Long "0" "Job completion status code"
'$$ OUTPUT_REPORT HTML "\\server\share\report.htm" "Output metadata file"
'===========================================================================================
' Default value for parameters
#ifndef REPORT_TITLE
#define REPORT_TITLE "Test Report"
#endif
#ifndef INPUT_METADATA
#define INPUT_METADATA "\\server\share\person.mdd"
#endif
#ifndef INPUT_CASEDATA
#define INPUT_CASEDATA "\\server\share\person.ddf"
#endif
#ifndef OUTPUT_REPORT
#define OUTPUT_REPORT "\\server\share\report.htm"
#endif
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
' Delete output if it exists with an S
If fso.FileExists(OUTPUT_REPORT) Then
fso.DeleteFile(OUTPUT_REPORT)
End If
Dim TableDoc
Set TableDoc = CreateObject("TOM.Document")
' Load dataset
TableDoc.DataSet.Load(INPUT_METADATA, , INPUT_CASEDATA, "mrDataFileDsc")
' Create the table with the name "Table1", the Age variable on the side axis,
' the Gender variable on the top axis, and a heading of "My First Table"
TableDoc.Tables.AddNew("Table1", "age * gender", REPORT_TITLE)
' Populate the table
TableDoc.Populate()
' Export the table
With TableDoc.Exports.mrHtmlExport
.Properties["DisplayLogo"] = False
.Properties["Interactive"] = False
.Properties["OverwriteOutput"] = True
.Properties["DisplayOption"] = "Table Only"
.Export(OUTPUT_REPORT)
End With
Note The #define directive is used to substitute text in a source file and to define identifiers whose values can be tested in an #if directive.
See also