Edit

DoReport (reportName, format, title, parameters...)

Result Type:  a path string

Definition:  Generates a report, either returning the text of the report, or a path to the generated output file.

Format can be "pdf", "html", "text" or "". For the first 3, the return value is the path to a temporary file that will be deleted when you quit. For a an empty or unknown format string, the function will return the actual tab-delimited report output instead of a path.

Parameters should be strings in the form "paramName=paramValue". An associative array is also acceptable.

All parameters are inserted into the name table and are available to the report. In this case your report would not run without the parameters being passed in this way, since they would otherwise be undefined.

You can pass values for custom controls defined for a report, but to have your passed values override those last stored in the report document, you must include an additional parameter "override_doc_custom=1".

Example:  In this case, the_name_code is the name of a custom control, so we must pass "override_doc_custom=1" as well in order to override the value stored in the report.

let pdfPath = DoReport("Statement.crep", "pdf", "Statement", "the_name_code=" + n.code, "override_doc_custom=1")

Availability:  MWScript handlers. Thus function is closely analogous to the command line and REST doreport commands. A similar DoReport command is also available to Applescript/COM.