Select different rows of condition file for each participant: Pavlovia

Description of the problem: hello

I am trying to draw some specific rows from my condition file according to the participant number.
I define lower and upper boundaries for each participant according to their participant number. The experiment has 60 trials and the condition file consists of 60*21 (plus the column header) number of rows in total.

I calculate the boundaries as (thanks for the formula to the user who put it to discourse):

lower = (participant_no-1)*60;
upper = (participant_no)*60;

and the boundary array as:
bounds = range(lower, upper,1);

where range function is defined as:

function range(start, count) {
  return Array.apply(0, Array(count))
    .map((element, index) => index + start);

in Builder, I put $bounds to selected rows section in the conditions window and it worked perfectly and it translated in Pavlovia as:

trialList: TrialHandler.importConditions(psychoJS.serverManager, 'repros.xlsx', bounds),

It indeed picks the right row to start from for each participant number, however, although it had to stop after 60 consequtive rows following that very first row, it never stops until (i suppose, didnt try it until the end to be honest) it reaches the end of the condition rows as if I never set an upper boundary for it to stop the experiment.

It works just fine if i enter explicit values instead of the “bound” (e.g., ‘0:10’ etc). I tried adding quotations, i tried lower:upper and ‘lower:upper’ as well but no chance so far.
PS: I checked similar threads before posting this but I couldnt find anything that could solve my problem.

Any suggestions would be much appreciated, thanks in advance, tutku

Hello tutku,

I have the following code to select the first or the second eight rows depending on the participant number:

start = '0'
end = '0'

if int(expInfo['participant'])%2 == 0:
    start = '0'
    end = '8'
    start = '8'
    end = '16'
zeilen = start + ":" + end

this translates to JS

start = "0";
end = "0";
if (((Number.parseInt(expInfo["participant"]) % 2) === 0)) {
    start = "0";
    end = "8";
} else {
    start = "8";
    end = "16";
zeilen = ((start + ":") + end);

I set $zeilen in Selected rows of the loop. So, start and end are defined strings and separated by a “:”

So, if I adopt this to your case:

lower = (participant_no-1)*60;
upper = (participant_no)*60;

$selrows = ((lower + ":")+upper);

should do the job unless I am missing something.

Why do you need the bounds = range(lower, upper, 1); call? BTW, I do not understand your range-function. You define it with two arguments but calling it with three arguments.

Best wished Jens