Professional > Table scripting > Annotations > Defining annotations
 
Defining annotations
Sample script file: Annotations.mrs
This example script is based on the Museum sample data set. See Running the sample table scripts for information on running the example scripts.
Setting up the project description
The {ProjectDescription} macro is used in the default annotation. To set up the text for this property, use the Description property of the Document.DataSet object. For example:
' Set up the text in the property that will be displayed by the ' {ProjectDescription} macro TableDoc.DataSet.Description = "Museum of the Living World" ' {ProjectDescription}
Here is a table that has been exported to HTML with the default annotations after setting up this property:
Changing the default annotations
The following example clears the built-in default settings and sets up the following new defaults:
Title Header. The table description, which is inserted using the {TableDescription} macro.
Left Header. Information about the filter is inserted using the {Filters \p} macro (using the \p switch inserts a text prefix) and formatted in italics.
Right Footer. The table number and the total number of tables, preceded by the text "Table: ", which is formatted in bold.
TableDoc.Default.Annotations.ClearAll()
TableDoc.Default.Annotations[0].Specification = "{TableDescription}"
TableDoc.Default.Annotations[1].Specification = "<i>{Filters \p}</i>"
TableDoc.Default.Annotations[7].Specification = "<b>Table: </b>{TableNumber} of {TotalNumberOfTables}"
Here is a table that has been exported to HTML with these annotations:
Note that you should always include the {Statistics} macro in one of the table annotations when one or more statistical tests have been defined, because the macro inserts important information about the tests that have been carried out. In all but the very simplest tables, you would normally also use the cell contents, filter, and weighting macros, and if you are working with hierarchical data, you should show the level as well.
Note To define default annotations for profile tables, use the TableDoc.ProfileDefault property. See Working with profile tables for more information.
Defining an annotation for an individual table
The next example shows defining an annotation for an individual table. If there is already a default annotation in that position, it will be overwritten:
TableDoc.Tables.AddNew("AgeByGender", "age * gender", "Age by Gender")
TableDoc.AgeByGender.Annotations[1].Specification = "<i>This table is not filtered</i>"
Here is the table:
See
Annotations