After attempting to select a subset of trials to use in an online experiment, I encountered an error within the importConditions function in data-3.0.0b11.js. The error occurs when the script reaches the line that reads:
selectedRows = selectFromArray(sheet, selection);
An error occurs here because there is no such function in the included Javascript libraries. I tested a simple fix for when the selection is given as an array:
if (selection != null) {
if (Array.isArray(selection)) {
let z = []
for (let i = 0; i < selection.length; i++) {
z.push(selectedRows[selection[i]])
}
selectedRows = z;
} else if (typeof selection === 'string' || selection instanceof String) {
//selectFromArray function does not exist, so this code results in an error:
selectedRows = selectFromArray(sheet, selection);
} else {
throw 'selection argument for importConditions is not an Array or a String.'
}
}
Needless to say, if “selection” is given as a string, an error will still be encountered. I was going to try to implement the necessary string parsing, but I think my adviser would rather I do research.
Is there an implementation of this feature in the works, or should I submit a pull request for this minimal trial selection functionality while we wait for the real deal?