What is the RouteOutput method; what is the AnalysisOutput object?

When running STATISTICA interactively, the output spreadsheets and graphs can be sent to workbooks (by default), stand-alone windows, reports, etc., depending on the selection of options on the Analysis/Graph Output Manager dialog (accessed by selecting Output from the button menu). The choices of options in that dialog are implemented by the AnalysisOutput object, which can be used as a "container" for the results spreadsheets and graphs. Typically, a summary results spreadsheet or graphs collection would be recorded as:

newanalysis.RouteOutput(newanalysis.Dialog.Summary).Visible=True

The RouteOutput method takes as an argument the Summary collection (of spreadsheets, graphs, or both) and places it into the workbook, report, etc. depending on the current selections on the Analysis/Graph Output Manager dialog. The RouteOutput method actually returns an object of type AnalysisOutput which itself has a number of methods and properties to make it fully "programmable."  

Note that the actual selections on the Analysis/Graph Output Manager dialog are recorded via the OutputOption object. Specifically, those options will be recorded either as part of Analysis Macros, if they are set or changed via the Output option for a specific analysis from the button menu, or they will be recorded as part of Master Macros if they are set or changed in a specific analysis as well as via the Output Manager tab of the Tools - Options dialog.

Suppose in your interactive analysis all results spreadsheets were automatically placed into a workbook; a macro recorded from such an analysis might look as shown in the following example. This example also illustrates how to access the results documents in the AnalysisOutput object (i.e., edit the recorded macro to access the results spreadsheets).

Sub Main

' NOTE: This file may reside in a different directory on
' your installation. Also, if you recorded this portion of
' the code via a Master Macro [option Tools - Macro - Start
' Recording of Log of Analyses (Master Macro) ], consecutive
' analyses would be enumerated as newanalysis1, newanalysis2,
' etc., and the input datafile spreadsheets would be explicitly
' assigned to variables (objects) S1, S2, etc.

Set
newanalysis = Analysis (scBasicStatistics, _
Path
& "\Examples\Datasets\exp.sta")
newanalysis.Dialog.Statistics = scBasFrequencies
newanalysis.Run
newanalysis.Dialog.Variables = "1-8"
' Create the Analysis Output object as requested by
' the current settings in the Output Manager.

Set
r=newanalysis.RouteOutput(newanalysis.Dialog.Summary)
' Make sure that the AnalysisOutput object contains a Workbook.

If
(r.HasWorkbook=True) Then
' We will next find the first results spreadsheet
' (frequency table) that was produced, and extract it
' from the workbook as a stand-alone spreadsheet; note
' that the objects are explicitly dimensioned in the
' following SVB code, to make it more transparent.

Dim
w As Workbook
Set
w=r.Workbook
Dim
wi As WorkbookItem
Set
wi=w.Root.Child
While
(wi.Type<>scWorkbookItemTypeSpreadsheet)
Set
wi=wi.Child
Wend
Dim
s As Spreadsheet
Set
s=wi.Extract(scWorkbookExtractCopy)
s.Visible=True
End If

End Sub