Example layouts
This topic shows you how to specify different types of grid layouts.
Nested grid with radio buttons in each cell
The layout you want to generate is as follows:
The metadata that creates it is:
Treatments "Treatment Options for Back Pain" compound
{
AntiInflam "Anti-inflamatory medication",
PainRelief "Pain relief",
PhysioHydro "Physiotherapy/Hydrotherapy"
} fields
(
ConfLoopFeatures "" loop {} fields (
ConfLoop "" loop
{
ConfLevel "Level of confidence in treatment" labelstyle(Width = "200px")
} fields (
Confidence "Level of confidence in treatment"
style(Align="left",Cell(BorderStyle = "Solid", BorderWidth="1"))
categorical [1..1]
{
NotConfident "Not at all confident",
LittleConfident "A little confident",
SomeConfident "Somewhat confident",
Confident "Confident",
VeryConfident "Very confident"
};
) expand ;
)expand;
FreqLoopFeatures "" loop {} fields (
FreqLoop "" loop
{
FreqLevel "Frequency of recommendation" labelstyle(Width = "200px")
} fields (
Frequency "Frequency of recommendation"
style(Align="left",Cell(BorderStyle = "Solid", BorderWidth="1"))
categorical [1..1]
{
Never "Never", Seldom "Seldom", Occasionally "Occasionally",
Frequently "Frequently", Always "Always"
};
) expand;
)expand;
);
The important points about this script are as follows:
▪The page consists of two three-dimensional grids side by side. This signals a compound item as the overall structure for the question. The thing that is common to both grids is the rows, so these become the control items for the compound item; that is, the items about which the questions are asked.
▪In a three-dimensional grid, the outer loop defines the repetition texts, while the inner loop defines the grid categories. In this example, the repetition texts for the ConfLoopFeatures and FreqLoopFeatures outer loop have already been defined as part of the compound item so their loop control lists are blank.
▪The responses to the question inside each inner loop become the contents of each grid cell so define these questions in the normal way.
▪The repetition texts for the inner loops match the question texts of the questions in the loops. The interviewing program uses the texts in the loop control lists as the column headings, but since you might need individual question texts for each cell for analysis purposes, the script defines the same text as part of the questions themselves.
▪The width of each grid is specified using labelstyle on the items in the inner loop control lists. This ensures an even column width across both grids.
▪The boxes around the grid cells are specified using the style keyword in the questions.
▪The radio buttons in each cell are indented because this is what the default layout template does. Add indent=-1 to each question’s style settings to omit the indent. This will also reduce the overall width of the boxed grid cells so you might want to reduce the label widths for the column headings by a corresponding amount.
See also