Previous Topic

Next Topic

Book Contents

Book Index

Switches (MS Word Report Writer)

The following describes the switches that can be used in MS Word Report Writer reports.

Switch

Report Section

Description

|fieldname|

Group or ReportStart (sub reports only)

A field name enclosed within vertical bars indicates that the text should be replaced by the current field value.

AlwaysShowSubReport

ReportStart

This ensures that the report section is shown even if there are no records to display. This is useful when the report is to provide a way of both displaying and entering data.

Field

Group

Specifies what field this particular group section should be grouped on

eg Field:=Class

ForceRecordGroup

Group

Forces a new record group and saves the current document to a temporary document. See SaveRecordGroup above.

 

Info

ReportStart (Main only)

Displays information about the report in a Message Box when the report is run.

InfoWhere

ReportStart (Main only)

Display information in a second paragraph about the WHERE clause of the report.

InputBox

ReportStart (Main only)

Displays one or more input boxes that allows the user to enter some text. This text can then be used by the report to manipulate the data displayed.

Each input box specification must be separated by the vertical bar character (|).

There are 3 sections to the input box specification. Each is separated by the back slash (/) character:
1. The message (Msg) to be displayed
2. The default value (Default) to display
3. The variable into which the text should be stored (ResultVariable)

eg InputBox:=Msg=Enter a date to identify the week you wish to print (format d/mmm/yyyy).\ Default=30/Mar/2004\ ResultVariable=SelectedDate

MERGEFIELD "Special!"

 

A special mergefield used not in a section but in the document itself

 

- RS

 

Specifies which recordset should be used.

eg RS:=1;

- Where

 

Specifies how the record set should be searched. A 'Find' is performed on the specified recordset for the first record that satisfies this criteria.

eg Where:=CycleDay=1;

- Return

 

Specifies what data should be printed on the report. The overall syntax for this switch is:

Return:= FldToReturn1 | FldToReturn2 | ...

Each FldToReturn section has the following syntax (note that the parts are separated by commas:

FldnameToReturn, NumberOfRowsToReturn, FldSeparatorChar, FldEndChar, FldPreText, FldPostText

The text that is printed to the report is determined by appending the:
FldPreText & (FldSeparatorChar & FldValue)*[each record returned] & FldPostText & FldEndChar

eg Return:=Day1,First,, CRLF | Day2, First,, CRLF | Period, All, " & ",, "Period "

MERGEFIELD "Cnt"

A special mergefield used not in a section but in the document itself

Returns the current number of records in the section. If used in a Detail section, it will act as a counter. If used in a Group footer section it will show the total detail records in that group.

ORDERBY

ReportStart

The way in which the SQL should be ordered.

eg ORDERBY := Surname, Name1

PageBreak

Group or Detail

Forces a page break either before or after the section.

eg PageBreak:=Before

RestartWord

ReportStart (Main only)

Specifies that every x records the MS Word application should be restarted. The MS Word automation can become slow in some instances if Word is not restarted periodically. Normally this value should be a multiple of the SaveRecordGroup value.

eg RestartWord := 10

RS?

Group or Detail

Allows the defining of a 'Special' recordset that can be used with in a report section. This functionality can be used when a sub-report is not appropriate.

eg RS1:=SELECT * FROM [Students] WHERE school_num=|school_num|

SaveRecordGroup

ReportStart (Main only)

Specifies that every x records the word document will be saved to a temporary file with a new temporary document holding the next x records. Once all records have been processed, the temporary documents are assembled into a single final document.

Car should be taken when using this option in reports that do not have a page break after each record. Reassembling the document in the middle of sequence of detail records can have unexpected results.

eg SaveRecordGroup := 5

SQL

ReportStart

Provides the SQL that the report (or sub-report) is to be based on. It should not include the WHERE or ORDER BY section of the SQL.

eg SQL := SELECT FullName FROM Names_Local

WHERE

ReportStart

Provides the where clause for the SQL. It is provided separately so it can be replaced at runtime.

eg WHERE:=Tag=TRUE