Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Creating wizards for UNICOM Intelligence Reporter > Creating the wizard
 
Creating the wizard
The wizard prompts the user for information when the user attempts to insert a Survey Reporter wizard item in UNICOM Intelligence Reporter. When the user has entered the required information, the wizard generally modifies an in-memory version of the Target currently open in UNICOM Intelligence Reporter.
Variable definitions inserted by the wizard
The wizard engine automatically inserts the following variable definitions into the routing script:
target_mtd
A Table Object Model Document (TOM.Document) object that references the currently open Target .mtd file. Changes to this document are visible immediately in the UNICOM Intelligence Reporter user interface and are saved to the .mtd file during the save process.
variables_selected[]
An array of IVariableListItem objects that represent the variables currently selected in the UNICOM Intelligence Reporter Variables pane. These are the wizard variables, chosen by the user, that are modified or used as the basis for a new variable. The array might be empty if no variables are selected, or might contain variables that are of no use for your wizard and need to be checked before use.
tables_selected[]
An array of ITable objects that represent the tables currently selected in the UNICOM Intelligence Reporter Tables pane. These are the wizard tables, chosen by the user, that are modified or used as the basis for a new table. The array might be empty if no tables are selected or might contain tables that are of no use for the wizard and need to be checked before use.
variables_added[]
An empty array that the wizard updates if it adds variables or folders to the target_mtd.DataSet.Variables collection. The UNICOM Intelligence Reporter interface uses this array to decide which variables to refresh in the Variables pane. Variables should first be added to the target_mtd using the Variables Interface or Change Tracker and then added to the variables_added[] array. The array simply indicates which variables should be refreshed in the user interface.
tables_added[]
An empty array that the wizard updates if it adds tables or folders to the target_mtd.Tables collection. The UNICOM Intelligence Reporter interface uses this array to decide which tables to refresh in the Tables pane. Tables should first be added to the target_mtd using the Tables or GroupedTables properties and then added to the tables_added[] array. The array simply indicates which tables should be refreshed in the user interface.
Wizard actions
The wizard can update the target_mtd, which means that UNICOM Intelligence Reporter must be notified of the wizard changes so that the application can efficiently update the user interface and track the changes required for undo and redo support. The possible wizard changes are specified in a comma-separated list of actions in the WizardActions property at the metadata’s Document level. The possible WizardActions are as follows:
AddsTables
Associated: tables_added[]
Set if the wizard will add tables or folders. The wizard must add the tables or folders to the tables_added[] array.
AddsVariables
Associated: variables_added[]
Set if the wizard will add variables or folders. The wizard must add the variables or folders to the variables_added[] array.
DisableUndoRedo
The wizard is requesting that undo and redo are disabled so that the changes before and after the wizard are not stored. This action should be used sparingly and will cause a warning to be displayed in the user interface.
UpdatesAll
Set if the wizard makes extensive changes to the target_mtd that would force the entire document to be reloaded. This is the default setting when WizardActions is not set or not recognized.
UpdatesAll does not perform well with tables documents that include numerous tables or variables. As such, the setting should be avoided unless required.
UpdatesDefaults
Set if the wizard will make changes to target_mtd.Default including Annotations, Axes, CellItems, Filters, Properties, Rules, Statistics, SortColumn/SortRow, or Weight.
UpdatesGlobals
Set if the wizard will make changes to target_mtd.Global including Annotations, CellItems, Filters, or Statistics.
UpdatesSelectedTables
Associated: tables_selected[]
Set UpdateSelectedTables if the wizard will make any changes to a table, including axis specifications, filters, or properties.
UpdatesSelectedVariables
Associated: variables_selected[]
Set if the wizard will make any changes to the variable.
UpdatesTables
Set if the wizard will make changes to the Tables list. This might include adding, updating, or removing tables (or changing the table grouping).
UpdatesVariables
Set if the wizard will make changes to the Variables list. This might include adding, updating, or removing variables (or changing the variable grouping).
Testing wizards
When a error occurs, UNICOM Intelligence Reporter wizards should display an error page and terminate with a Stopped signal. This indicates to UNICOM Intelligence Reporter that no changes have been made.
Because UNICOM Intelligence Reporter wizards are created in UNICOM Intelligence Professional, and there is no way for UNICOM Intelligence Professional to set wizard variables implicitly, for testing purposes you must create the variables and set them as specified. When testing is complete and the wizard is ready to be deployed, you should comment out those lines of code. When running the wizards from UNICOM Intelligence Reporter, debugging or error logs are written to the IVW log in the Logs directory (if user encounters an error you might find more information there). Alternatively, you can catch all errors in the wizard script and display a more detailed error to the user.
For an example Wizard script, see UNICOM Intelligence Reporter wizard examples.
See also
Creating wizards for UNICOM Intelligence Reporter