Multiple independent lm lists for switching task

Home Forums Support Multiple independent lm lists for switching task

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #894


    I’m very new to Qualtrics and QRTEngine. I’ve been through the tutorials and am trying to set up a switching experiment.

    I have a list of 72 stimuli to show participants in a random order, and that part is working fine. However I want to ask participants to perform one of two tasks on each trial (is the number lower/higher than 5 or is the number odd or even?). I want the task instruction to be chosen at random and saved in the data so that I can categorise each trial as a switch or repeat trial, but I don’t want the instructions to be tied to specific trials. I think that if I have a column in my lm list for ‘task instruction’, it will have to be tied to specific trials, i.e. item 5 is odd/even, item 6 is high/low?

    Is there a way to have separate independent lm lists, so that for each trial the stimulus is selected from one list and the instruction is selected from another list? Or is there another way to achieve what I’m trying to do?

    Thank you in advance for any help!

    Erwin Haasnoot

    Hi Nina,

    Sorry about the delayed response.
    I’m afraid this will be fairly difficult to do. Qualtrics doesn’t allow the nesting of blocks, thus you can’t really nest L&M lists properly. There are several ways in which you can approach this behaviour, however, but take care that these are by no means perfect solutions and necessarily make use of quite a bit of JavaScript.

    The solution will randomly decide whether lower-than-5 or odd/even is asked, and then should use conditional logic to display the necessary stimuli.

    The crux is in how to generate these random decisions. What I think is the best is to generate an array with 36 ‘lower-than-5’ values, and 36 ‘odd/even’ and then shuffle them.

    //Get the shuffled array
    shuffledArray = QRTE.getBlockData(‘shuffledArray’);

    //Check if it exists (does not at the start)
    if(typeof shuffledArray === ‘undefined’) {

    //Use knuth’s algorithm to shuffle the array, taken from:
    function knuthfisheryates(arr) {
    var i, temp, j, len = arr.length;
    for (i = 0; i < len; i++) { j = ~~(Math.random() * (i + 1)); temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } return arr; } //Fill the array that needs to be shuffled! shuffledArray = []; for(var i = 0; i < 36; i += 1) { shuffledArray.push('lower-than-5'); shuffledArray.push('odd/even'); } shuffledArray = knuthfisheryates(shuffledArray); QRTE.setBlockData("shuffledArray",shuffledArray); } //Set trial data to type QRTE.setTrialData('currentTrialType',shuffledArray[parseInt("${lm://CurrentLoopNumber}") - 1]); //CurrentLoopNumber defines the current loop And then use QRTE.getTrialData('currentTrialType') for the conditional logic in the Stimuli that need to be displayed upon either type of tasks. I hope this short summary on how to solve the problem helps, do not hesitate to contact us if you require more assistance. Best regards, Erwin Haasnoot

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Support’ is closed to new topics and replies.