Run Batch file based on participant ID and session number


Author
Message
jparong
jparong
New Member (26 reputation)New Member (26 reputation)New Member (26 reputation)New Member (26 reputation)New Member (26 reputation)New Member (26 reputation)New Member (26 reputation)New Member (26 reputation)New Member (26 reputation)
Group: Forum Members
Posts: 2, Visits: 30
I am trying to run a batch script and assign files based on participant ID and session number. I want to have all participants do the tasks in session 1, split the groups to do 2 different versions of tasks in session 2 with odd participant IDs doing version A and even participant IDs doing version B, and then all participants would do all the tasks again in session 3. I tried the script below and it doesn't seem to work. Any advice would be very appreciated! Thanks!

<batch Task1>
/ sessions = (1 of 3)
/ file="Task1.iqx"
</batch>

<batch Task2A>
/ subjects = (1 of 2)
/ sessions = (2 of 3)
/ file="Task2A.iqx"
</batch>

<batch Task2B>
/ subjects = (2 of 2)
/ sessions = (2 of 3)
/ file="Task2B.iqx"
</batch>

<batch Task3>
/ sessions = (3 of 3)
/ file="Task3.iqx"
</batch>




Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
jparong - 4/1/2020
I am trying to run a batch script and assign files based on participant ID and session number. I want to have all participants do the tasks in session 1, split the groups to do 2 different versions of tasks in session 2 with odd participant IDs doing version A and even participant IDs doing version B, and then all participants would do all the tasks again in session 3. I tried the script below and it doesn't seem to work. Any advice would be very appreciated! Thanks!

<batch Task1>
/ sessions = (1 of 3)
/ file="Task1.iqx"
</batch>

<batch Task2A>
/ subjects = (1 of 2)
/ sessions = (2 of 3)
/ file="Task2A.iqx"
</batch>

<batch Task2B>
/ subjects = (2 of 2)
/ sessions = (2 of 3)
/ file="Task2B.iqx"
</batch>

<batch Task3>
/ sessions = (3 of 3)
/ file="Task3.iqx"
</batch>




The way you've defined the <batch> elements,

<batch Task2A>
/ subjects = (1 of 2)
/ sessions = (2 of 3)
/ file="Task2A.iqx"
</batch>

will be executed if either

/ subjects = (1 of 2)

is true (i.e. the subject number is odd), or

/ sessions = (2 of 3)

is true., or both.

The way to do this, then, is to simply define three sessions

<batch Task1>
/ sessions = (1 of 3)
/ file="Task1.iqx"
</batch>

<batch Task2>
/ sessions = (2 of 3)
/ file="Task2.iqx"
</batch>

<batch Task3>
/ sessions = (3 of 3)
/ file="Task3.iqx"
</batch>

and have "Task2.iqx" be a simple shim that runs either version A or version B based on the subject number being odd vs even:

<include>
/ precondition = [
    mod(script.subjectid, 2) == 1;
]
/ file = "task2a.iqx"
</include>

<include>
/ precondition = [
    mod(script.subjectid, 2) == 0;
]
/ file = "task2b.iqx"
</include>


Attachments
sessions.zip (172 views, 1.00 KB)
jparong
jparong
New Member (26 reputation)New Member (26 reputation)New Member (26 reputation)New Member (26 reputation)New Member (26 reputation)New Member (26 reputation)New Member (26 reputation)New Member (26 reputation)New Member (26 reputation)
Group: Forum Members
Posts: 2, Visits: 30
Dave - 4/2/2020
jparong - 4/1/2020
I am trying to run a batch script and assign files based on participant ID and session number. I want to have all participants do the tasks in session 1, split the groups to do 2 different versions of tasks in session 2 with odd participant IDs doing version A and even participant IDs doing version B, and then all participants would do all the tasks again in session 3. I tried the script below and it doesn't seem to work. Any advice would be very appreciated! Thanks!

<batch Task1>
/ sessions = (1 of 3)
/ file="Task1.iqx"
</batch>

<batch Task2A>
/ subjects = (1 of 2)
/ sessions = (2 of 3)
/ file="Task2A.iqx"
</batch>

<batch Task2B>
/ subjects = (2 of 2)
/ sessions = (2 of 3)
/ file="Task2B.iqx"
</batch>

<batch Task3>
/ sessions = (3 of 3)
/ file="Task3.iqx"
</batch>




The way you've defined the <batch> elements,

<batch Task2A>
/ subjects = (1 of 2)
/ sessions = (2 of 3)
/ file="Task2A.iqx"
</batch>

will be executed if either

/ subjects = (1 of 2)

is true (i.e. the subject number is odd), or

/ sessions = (2 of 3)

is true., or both.

The way to do this, then, is to simply define three sessions

<batch Task1>
/ sessions = (1 of 3)
/ file="Task1.iqx"
</batch>

<batch Task2>
/ sessions = (2 of 3)
/ file="Task2.iqx"
</batch>

<batch Task3>
/ sessions = (3 of 3)
/ file="Task3.iqx"
</batch>

and have "Task2.iqx" be a simple shim that runs either version A or version B based on the subject number being odd vs even:

<include>
/ precondition = [
    mod(script.subjectid, 2) == 1;
]
/ file = "task2a.iqx"
</include>

<include>
/ precondition = [
    mod(script.subjectid, 2) == 0;
]
/ file = "task2b.iqx"
</include>


Thank you for the quick reply, Dave!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search