Indicating table status in UNICOM Universal Gateway (UniGW)
If you are using UNICOM Universal Gateway (UniGW), you can indicate status at table level. The UniGW dashboard can display information about interviewing reports: a list of tables which are highlighted according to their status. For example, you might configure the “Queue Status” report to appear in the dashboard so that you can see at a glance if any participant/sample queue needs attention.
(Table status can also be used when integrating with third‑party applications. It is not used in Reporter or Survey Tabulation).
To integrate with UniGW, set Table.Status to “ok”, “warning”, or “error”. For example, you might decide that if any cell in the table is red (see
Highlighting cells: Status cell item), the table status should be “error”. To check the status of a cell, use the Table.HasCellStatus() method.
See also:
Example
The following script could be run after every table population, so it can be used in the
OnAfterPopulate event. The script is then stored in the .mtd file to be run by Reporter or Survey Tabulation, or through the Interviewing Reports web service to to integrate with UniGW or other dashboard systems.
If Table.HasCellStatus("R") Then
Table.Status = "error"
ElseIf Table.HasCellStatus("Y") Then
Table.Status = "warning"
ElseIf Table.HasCellStatus("G") Then
Table.Status = "ok"
Else
Table.Status = ""
End If
See also
Table properties
The Properties collection on the Table object contains a collection of Property objects. Each property consists of a name and value and controls a table option, such as what to display for percentage values that are rounded to zero. The table properties automatically take their values from the corresponding properties in the Document.Default.Properties collection. This means that you can set up default properties for all new tables and optionally overwrite one or more of them on individual tables. Changing the default properties does not change the properties of tables that have already been created.
Recognized table properties
AdjustRounding
Rounding anomalies mean that row and column percentages created from single response variables do not always add up to 100%. This property has a Boolean value that controls whether the rounding of row and column percentages is to be adjusted so that they add up to 100%. See
Rounding for more information.
Default value: False
AutoBaseSpecification
Defines the specification for the base element that the Table Object Model automatically adds to tables with no base. This enables you to change the label, hide the autobase, or base it on an expression.
AutoUnweightedBases
Controls whether the Table Object Model automatically adds an unweighted base element to all weighted tables. For more information, see
Base element.
Default value: True
AutoUnweightedBaseSpecification
Defines the specification for the unweighted base element that the Table Object Model automatically adds to weighted tables. This enables you to change the label, hide the autobase, or base it on an expression.
MinBase
Specifies a minimum value for the base. No results are displayed in cells where the base is below this value. If there are multiple bases in an axis because of nesting or because additional bases have been specified, the nearest base to the cell is used to determine the cell’s suppression state.
Default value: 0.0 (indicates no suppression)
MinBaseOptions
Additional options for use when specifying a minimum base value. Multiple options can be combined by adding the values together. See following table for details of individual options.
Default value: False
MinBaseSymbol
Specifies a symbol to display instead of the result when a cell value is suppressed because the base is below the minimum specified in MinBase.
Default value: *
RoundingOptions
Defines the default rounding options. A value of 0 means round 0.5 to even; a value of 1 means round 0.5 up (away from 0). Refer to the “RoundOptions” topic in the UNICOM Intelligence Developer Documentation Library for more information.
Default value: 0
RoundZeroCountSymbol
Defines one or more characters that are used to represent count values that have been rounded to zero. The value can be any text string.
Events
Events are predefined objects that specify actions that are to take place at certain points in the script.
The only event available is OnAfterPopulate.
OnAfterPopulate event
The OnAfterPopulate event runs directly after population occurs. Use it to run a script in Reporter after a table is generated. For example, you can use it to:
▪create a table item that is not available in Reporter, but that can be calculated and hardcoded into the table by using the
DefinedValues function.
Example
This example shows how to set the Table.Status.
Table.OnAfterPopulate = "!
If Table.HasCellStatus("R") Then
Table.Status = "error"
ElseIf Table.HasCellStatus("Y") Then
Table.Status = "warning"
ElseIf Table.HasCellStatus("G") Then
Table.Status = "ok"
Else
Table.Status = ""
End If
!"
See also
Working with metadata
When you work with the Table Object Model, you can access the metadata in the MDM Document using the Table Object Model Document.DataSet.MDMDocument property. The MDM Document is returned in no-save mode, which means that any changes you make are not saved.
The MDM Document, part of the Metadata Model, is documented in the Data Model section of the UNICOM Intelligence Developer Documentation Library. See
Working with the Metadata Model.
See also
Working with versions
Sample Script Files: WorkingWithVersions.mrs, RDBTables.mrs.
These example scripts are based on the Short Drinks sample data set. To run examples using the Short drinks sample data set, you need access to a SQL Server installation on which the Short Drinks sample database has been restored, and appropriate user access rights. For more information, see
Restoring the Short Drinks sample database. For information on running the example scripts, see
Running the sample table scripts.
As a survey progresses, changes are sometimes made to the questionnaire. For example, questions and categories might be added and deleted. Typically a new version is created in the metadata each time a change is made to the questionnaire and each version corresponds to a variation of the questionnaire used for some of the interviews.
By default, when you load a data set that contains more than one version, all of the versions are combined to form a superset (sometimes called a superversion). This means that all of the variables and categories from all of the versions are available. When there is a conflict between, for example, a text in one or more of the versions, the more recent versions generally take precedence over the older versions. It is possible to load a particular version or versions and to change the order of precedence. However the order of questions and categories is always taken from the most recent version.
You select the metadata version you want to load by specifying a version expression (see
Version expressions) in the sixth parameter of the
DataSet.Load method. The order in which you specify the versions in the expression defines the order of precedence. For example, the following loads version 2:
TableDoc.DataSet.Load("[INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\ Data\Mdd\short_drinks.mdd", _
, _
"Provider=MSOLEDBSQL.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=short_drinks;Data Source=LocalHost", _
"mrRdbDsc2", _
"short_drinks", _
"{2}")
The following script loads a superset of versions 2 through 4, with the older versions taking precedence over the newer ones:
TableDoc.DataSet.Load("[INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\ Data\Mdd\short_drinks.mdd", _
, _
"Provider=MSOLEDBSQL.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=short_drinks;Data Source=LocalHost", _
"mrRdbDsc2", _
"short_drinks", _
"{4..2}")
It is important to understand that the version of the metadata you select does
not affect the case data that is loaded. However, case data collected using UNICOM Intelligence Interviewer - Server Admin has the name of the version used to collect it stored in the
DataCollection.MetadataVersionNumber system variable (see
System variables).
See also
Changing the base to reflect the version
Sample script file: PercentageOnElementsAsked.mrs
This example script is based on the Short Drinks sample data set. To run examples using the Short drinks sample data set, you need access to a SQL Server installation on which the Short Drinks sample database has been restored, and appropriate user access rights. For more information, see
Restoring the Short Drinks sample database. For information on running the example scripts,
Running the sample table scripts.
ShiftColPropResults
Export the significance letters to a separate column that is headed by the significance letter for the column. See also
MergeColPropResults.
Type: Boolean
Default value: False
SplitCells
Indicates that each type of cell contents is to appear in a separate table. This is useful if you want to perform calculations on the output or set up your own charts in Excel.
Type: Boolean
Default value: False
UseElementLabels
Determines whether element names or the more friendly element labels are to be used for the row and column labels in the exported tables.
Type: Boolean
Default value: True
(Use labels)
UseExcelStyles
Indicates that formatting is to be controlled by styles. See
Microsoft Excel tables export formattingfor more information.
Type: Boolean
Default value: False
UseFormattedAnnotations
Enables you to use HTML formatting of annotations when exporting to Excel. When the value of this property is True, the annotation is copied as formatted HTML, using the clipboard. When the value is False, the annotation is copied as plain text, so that all tags (except <br/>) appear in the Excel output.
Set this option to False in a server environment.
Type: Boolean
Default value: True
UseVariableLabels
Determines whether variable names or the more friendly labels (descriptions) are to be used for variable texts in the exported tables.
Type: Boolean
Default value: True
(Use labels)
WrapLabelText
Determines whether to wrap long labels (descriptions) to the next line.
Type: Boolean
Default value: True
Examples
1. Using Excel styles
You indicate that you want the formatting to be controlled by styles by setting the UseExcelStyles export property to True:
TableDoc.Exports.mrExcelExport.Properties["UseExcelStyles"] = True
2. Creating a separate table for each type of cell contents
By default, each table in your script is exported as a single table to a separate Excel worksheet. However, you can optionally choose to export each type of cell contents to a separate table. All of the tables are placed on the same worksheet. This option is useful if you want to perform calculations on the output or set up your own charts in Excel. You select this option by setting the SplitCells export property to True:
TableDoc.Exports.mrExcelExport.Properties["SplitCells"] = True