Developer Documentation Library > Scripting > mrScriptMetadata User's Guide > mrScriptMetadata reference > Field definitions > Grid
 
Grid
A grid is an alternative way of defining a Categorical loop that has the grid and expand keywords specified. To display correctly, a grid must contain only simple questions and not any nested grids, loops, blocks, or compounds.
Syntax
For clarity, each item is shown on a separate line, and optional items are indented, See also Syntax conventions.
field_name
  [ "field_label" ]
  [ [ <properties> ] ]
  [ <styles and templates> ]
grid
<categories>
fields
(
<field> (; <field> )* [;] )
  [ row | column ]
  [ noexpand ]
Parameters
field_name, field_label
See Names and labels for more information.
<properties>
You can define custom properties for your field to store information that is not directly supported by the Metadata Model (MDM). See Custom properties for more information.
<styles and templates>
You can use styles and templates to define the appearance of a question. See Styles and templates for more information.
<categories>
Defines the category list that controls the iterations of the grid. This is called the controlling category list. You define it in the same way as the category list for a Categorical question.
<field>
Defines a question within the grid. See Field definitions for more information.
row
Specifies that the categories in the controlling category list are to be displayed as rows. Note that this is the default behavior if neither the row or column keywords are specified.
column
Specifies that the categories in the controlling category list are to be displayed as columns.
noexpand
The UNICOM Intelligence Data Model can represent the case (response) data collected using a grid in a “flattened” format, a hierarchical format, or in both formats. Which format is used depends on how you define the grid and the format in which the case data is being stored (because the capabilities of the various CDSCs vary). By default, the case data is stored in either a flattened format only, or in both flattened and hierarchical formats, depending on the CDSC. For a SPSS .sav file, for example, only the flattened format will be used because the does not support a hierarchical view of the data. However, if the DSC supports both a hierarchical and a flattened view of the data (such as RDB DSC 2 does), the data is represented in both formats, providing that the grid is not nested within another grid or loop. However, if you are using a CDSC that supports hierarchical data, you can use the noexpand keyword to specify that data should be stored in a hierarchical format only.
For more information about hierarchical data, see Hierarchical data in the MDM.
Example
This example creates a simple grid. The controlling category list consists of a selection of drinks and the single question is a multiple response categorical containing a category for each day of the week:
Drinks "Which of the following drinks did you consume last week?" grid
{
Milk,
Coffee,
Tea,
Orange
}
fields (Days categorical
{
Monday, Tuesday, Wednesday,
Thursday, Friday, Saturday, Sunday
};
);
The following illustration shows the Drinks grid, although its exact appearance will depend on the mode of interviewing and the formatting options applied.
This graphic is described in the surrounding text.
See
Field definitions