Hiding a Category in a Pick One Question

From Q
Jump to navigation Jump to search

This hides the "Don't Know" category from the table, but the category is still included in the table's base. This means respondents who chose "Don't know" are still included in the NET.

var age = project.dataFiles[0].getQuestionByName('Age');
age.dataReduction.hide("Don't know");

The first line of this code finds a question named Age in the first data file (note that [0] finds the first data file, [1] would find the second, etc. ) and assigns it to a variable called age.

The second line of the code modifies the question called age. It does so using the question’s DataReduction. The DataReduction is the object that stores which categories have been merged together, which have been hidden, what their names are and what order they are shown in. Thus, the hide instruction is hiding the Don’t know category and this will cause the category not to appear when this question is used to create tables and charts.

See also