QScript RVariableConfiguration
Jump to navigation
Jump to search
RVariableConfiguration
The R code, Inputs JavaScript and options that R variables are calculated from. Get it from Variable.sharedRConfiguration. R variables, including ones in different variable sets, can share a configuration, so changing it changes all of them. Setting code or codeForGuiControls recalculates them, and in a variable set with more than one variable, resets each label to its R column name.
code
Get or set the R code. Unlike Variable.code, invalid code doesn't throw: the error shows on the variables instead, so code that uses new controls can be set before codeForGuiControls.
codeForGuiControls
Get or set the JavaScript code that creates the controls that customize the R code. See the documentation.
equals(obj)
Whether two objects are the same.
| obj | The object to compare against. |
| Returns: | true or false |
| Example: | data_file.getQuestionByName('Q2').equals(data_file.questions()[0])
|
guid
The configuration's GUID. R variables share a configuration when these match.
setCode(code, code_for_gui_controls)
Sets code and codeForGuiControls in one edit, so a renamed control can't fail against the other's old value whichever is set first. Throws if the R code errors.
| code | The new code. |
| code_for_gui_controls | The new codeForGuiControls. |
| Example: | config.setCode('rep(formN, 5)', "form.numericUpDown({name: 'formN', default_value: 2})");
|
type
Returns "RVariableConfiguration".