QScript Question

From Q
Jump to: navigation, search

Question

A question from one of the data files in your project, corresponding to a question in Q. A question is made up of one or more variables.

dataFile

Gets the DataFile object that this question is part of.

dataReduction

Gets the DataReduction object for this question.

deleteQuestion()

Deletes this question.

duplicate(name)

Duplicates this question and its variables. This is the same as using "Copy and Paste Question(s) | Exact" in Q.
nameThe name for the new question.
Returns:The new Question object.

equals()

Whether two objects are the same.
Returns:true or false
Example:
data_file.getQuestionByName('Q2').equals(data_file.questions()[0])

guid

Get the question's internal unique identifier.

isBanner

Returns true if this question is a banner, false otherwise. Banner questions and their variables cannot be modified directly, as they are simply a combination of their input questions.

isFilter

Gets/sets whether this question can be used as a filter in crosstabs, etc.

isHidden

Gets/sets whether this question is hidden, and thus cannot be used in crosstabs, etc.

isValid

Returns true is this question is valid, false otherwise. A question will be invalid if any of its variables are invalid, or it is a Grid type and Q cannot determine the 2D structure in the variable labels.

isWeight

Gets/sets whether this question can be used as a weight in crosstabs, etc.

name

Get/set the question's name.

needsCheckValuesToCount

A flag that determines whether a Pick Any question has had its Values to Count checked or not. Set to false to remove the CHECK status from a newly created Pick Any Question.

questionType

Deprecated for Displayr - see variableSetStructure. Get or set the Question's type. This can be one of 'Text', 'Number', 'Pick One', 'Text - Multi', 'Number - Multi', 'Pick Any', 'Pick One - Multi', 'Pick Any - Compact', 'Pick Any - Grid', 'Number - Grid', 'Experiment', 'Ranking', 'Date' (date/time).

type

Returns 'Question'.

uniqueValues

Returns the unique source values found in this question, as an array. The values in the array are sorted in ascending order, with any missing data (NaN) first. The values are source values (prior to any Value Attributes or Recode Rules being applied).

valueAttributes

Gets the ValueAttributes object for a question. Typically you use this to adjust the values to count (for Pick Any questions), category names, or to remap values.

variables

Gets an array of all the Variable objects that constitute this question.

variableSetStructure

Get the Question's type as used in Displayr, which is a combinatio of questionType and (for Pick One questions) its variable types. This can be one of 'Text', 'Numeric', 'Nominal', 'Ordinal', 'Text - Multi', 'Numeric - Multi', 'Binary - Multi', 'Nominal - Multi', 'Ordinal - Multi', 'Binary - Multi (Compact)', 'Binary - Grid', 'Numeric - Grid', 'Experiment', 'Ranking', 'Date/Time'.