Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

subject number as worker number

hi

I have an experiment with several components,

  1. can I impose the jatos worker ID to be the subject number?
  2. I use a form (lab.js) as the first component can I set the osweb subject number to be one of the values from the form?

thank you

Dror

Comments

  • Hi @drorgarbi

    If you leave the `possible subject numbers` field empty in the osweb extension then the jatos component result ID will be used as the subject_nr. You should be able to set the worker ID yourself at the start of your experiment using an inline_javascript containing:

    vars.subject_nr = jatos.workerId
    

    (or any other ID described on http://www.jatos.org/jatos.js-Reference.html#ids).

    Point 2 is a bit more difficult. You can supply the subject_nr as an URL parameter (e.g. yourjatosserver.com/publix/etc/etc?subject_nr=123 ) but I don't know how to do this from within another component. Maybe @kri knows this?

    Buy Me A Coffee

  • the inline script works great, now I just need to understard how to do the same on lab.js / find out the solution to point 2


    thanks

    Dror

  • I just thought of something. Jatos also allows you to set session variables, see http://www.jatos.org/jatos.js-Reference.html#studys-session-data. What if you create such a session variable in the lab.js script, e.g.:

    jatos.studySessionData.subject_nr = your_variable_from_labjs
    

    and then in osweb (similar to the first solution):

    vars.subject_nr = jatos.studySessionData.subject_nr
    

    That way, you should be able to transfer the subject_id variable across components.

    Buy Me A Coffee

  • I agree with Daniel, the Study Session can be used in this case to transfer information from one component to another. And the example Daniel gave is perfect ;)

    Best,

    Kristian

  • Hey there.

    Unfortunately that solution doesn't work for me. I included the following line into the first line of the prepare phase of the counterbalancing- inline java script:

    But OS Web (1.3.13.0) just ignores it and continues using the "default ID", which is the componentResultId.

    Since my experiment consists of two parts and the OSWeb-part is the second one, it always gets an even componentResultId and therefore an even subject_nr. So the counterbalancing doesn't work.

    My rather suboptimal solution for that problem was to modify the corresponding line in jatos.js from

    let subject_nr = jatos.componentResultId

    to

    let subject_nr = jatos.studyResultId

    But I rather not modify the jatos.js and would really prefer to have it all done in OSWeb. So I was wondering, where that problem might come from.

    Thanks, Wolf

Sign In or Register to comment.