Professional > Interview scripting > Writing interview scripts > Dealing with errors > Using a custom validation function > Defining the error message
 
Defining the error message
You define the error message you want to use as an info item in the metadata section. This is essential for multilingual projects because it makes the message text available for translation. It’s good practise for single language projects too, although in these projects you can define the message text in the routing section. Here is the metadata section for the example, with the error message defined at the end:
SelectBrand "Which brands do you like? Please select from set A or B,
but not both."
categorical [1..]
{
BrandSetA "Brand set A"
{
Brand1 "Brand 1", Brand2 "Brand 2", Brand3 "Brand 3"
},
BrandSetB "Brand set B"
{
Brand4 "Brand 4", Brand5 "Brand 5", Brand6 "Brand 6"
},
' Indent=0 forces responses to line up with the subheadings
  OtherBrands "Other" style(Indent = 0) other(OtherBrand ""
      text [1..40] ) fix,
  NoAnswer "No answer" style(Indent = 0) na
};
' Define the error message
SelectBrandError "Select from Brand Set A OR Brand Set B." info;
Notice how the two sets of responses have been defined. These will appear as two subheadings followed by three responses each. The responses in each set will be indented using the standards built into the interviewing program.
Because there is no statement that marks the end of the second brand set, the interviewing program will assume that all responses up to the end of the definition are part of that set. Since this is not the case, the definitions for the Other and No answer responses have a style setting that resets to indent back to 0 so that these responses line up with the subheadings rather than with the responses in the second set. For more information, see Indenting response lists.
See also
Using a custom validation function