Professional > Table scripting > Table specification syntax > Special elements > Autocoding text variables
 
Autocoding text variables
Sample Script File: SpecialElements.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.
address{London 'London' expression('address.find(""london"") <> -1'),
  Liverpool 'Liverpool' expression('address.find(""liverpool"") <> -1'),
  Aberdeen 'Aberdeen' expression('address.find(""aberdeen"") <> -1'),
  Leeds 'Leeds' expression('address.find(""leeds"") <> -1'),
  Edinburgh 'Edinburgh' expression('address.find(""edinburgh"") <> -1'),
  OtherCities 'Other cities' expression('address.find(""london"") = -1
    And address.find(""liverpool"") = -1 And address.find(""aberdeen"")
                                                                 = -1
    And address.find(""Leeds"") = -1 And address.find(""Edinburgh"") = -1
And Not address.IsEmpty()'),
NotAnswered 'Not answered' expression('address.IsEmpty()')}
This example creates an axis based on the address text variable and uses custom expressions to automatically code the responses into categories by using the Find function.
See also
Special elements