Variables in error messages
The following example uses fixed text in the definition of the error message. You can make the script more flexible by replacing the subheading texts in the error message with variables and then including some extra statements in the routing section that replace the variables with the subheading texts. This means that if you change the subheadings you do not have to remember to update the error message text as well. In the example, the metadata definition for the error message would become:
SelectBrandErr "Please select from {InsertBrandSetA} or {InsertBrandSetB}."
info;
and the following statements would be added to the validation function:
IOM.Questions.SelectBrandError.Label.Inserts["InsertBrandSetA"] _
= Question.Categories[{BrandSetA}].Label
IOM.Questions.SelectBrandError.Label.Inserts["InsertBrandSetB"] _
= Question.Categories[{BrandSetB}].Label
See
Programmatically inserting text into labels for further details about substitution using Inserts.
For an example that shows how to add more than one new message to the Errors collection and how to choose which of those messages to display, see the ranking question in the NewFeatures.mdd script in [INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\Scripts\Interview\Projects\NewFeatures.
See also