Professional > Table scripting > Getting started > Creating tables based on database questions
 
Creating tables based on database questions
Sample script file: CreatingTablesBasedOnDatabaseQuestions.mrs
There are three kinds of database questions: single response, multiple response, and database arrays. Database questions cannot be directly added to tables, they first need to be categorized to derived categorical variables, which can then be added to tables. For example, to categorize a multiple response database question, you could use following script:
TableDoc.Coding.CreateCategorizedDBVariable("languages_spoken", "languages_spoken.DBCodes", -1, True, True)
You could then add the derived categorical variable languages_spoken.DBCodes:
TableDoc.Tables.AddNew("Table2", "languages_spoken.DBCodes")
The resulting table is:
You could use the following script to categorize a database array:
TableDoc.Coding.CreateCategorizedDBVariable("trip[..].countries[..].CitiesGrid", "trip[..].countries[..].CitiesGrid[..].DBCodes",
-1, True, True)
You would then add the derived categorical variable languages_spoken.DBCodes:
TableDoc.Tables.AddNew("Table3", "trip[..].countries[..].CitiesGrid[..].DBCodes * trip[..].countries[..].CitiesGrid[..].Rating")
Note The derived variable trip[..].countries[..].CitiesGrid[..].DBCodes acts as the loop iteration in tabulation.
Here is the table produced by the script:
Requirements
UNICOM Intelligence Reporter 6 or later
Next
Defining statistical tests
See also
Getting started