Creating a Nested Banner

From Q
Jump to navigation Jump to search

The script below shows an example of how to generate a banner using QScript. In most cases it is not necessary to create banners with a script because banners can be created using Create > Banner > Drag and Drop.

// Working on Phone.sav, this creates a new banner question
// with 'Gender' nested under 'Age'.  The banner question can then
// be selected in the blue or brown dropdown.
var data_file = project.dataFiles[0];
data_file.createBanner("Demographic banner with nesting",
                                  [[data_file.getQuestionByName('Age'),
                                    data_file.getQuestionByName('Gender')],
                                   [data_file.getQuestionByName("Work status")]]);

See also