Take a parameter from one component and use it in the next component.

87 views
Skip to first unread message

Iair Embon

unread,
Oct 2, 2020, 10:06:53 AM10/2/20
to ja...@googlegroups.com
Hello,
We are using jatos to run a metacognition experiment, and we were wondering if it is possible to take a parameter from one component (practice trials) and use it in the next component (the actual experiment). The parameter we want to take from the first component is for the staircase procedure and adjust the difficulty of the task.

Thanks for the answers in advance.
Best regards,
iair

Elisa Filevich

unread,
Oct 2, 2020, 11:10:47 AM10/2/20
to JATOS
Hi Iair, 

Sure, you can use the study session data for that

It's a simple JavaScript object that is accessible to all components in a study, so you can set it in the staircase component by simply doing

jatos.studySessionData = difficulty;

And use it at the beginning of your task by calling it:

jatos.studySessionData


Best
Elisa



--
You received this message because you are subscribed to the Google Groups "JATOS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jatos+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jatos/CAAnHEvvGtGaYCQDPQdVOOr6KTkyfF6aAUfVi5A2fUP2NXO3Kcg%40mail.gmail.com.

Iair Embon

unread,
Oct 5, 2020, 4:01:09 PM10/5/20
to ja...@googlegroups.com
Thanks for your reply.

I couldn't get it to work with jatos.studySessionData (not sure why), but it worked fine with jatos.batchSession.setAll similarly.

Best regards
Iair

Kristian Lange

unread,
Oct 5, 2020, 4:58:02 PM10/5/20
to JATOS
Hi Liar!
Although jatos.studySessionData is the preferred one in this case, you can use jatos.batchSession.setAll for this too. Just keep in mind that there can be concurrency issues if two study runs write into the batch session at the same time. In some cases one can prevent this by turning off the batch session's versioning (http://www.jatos.org/jatos.js-Reference.html#jatosbatchsessionversioning).
Best,
Kristian

María da Fonseca

unread,
Oct 10, 2020, 5:31:50 PM10/10/20
to JATOS
Hi Elisa and Kristian,

I am also interested in this topic to call the staircase result in another component. I used jatos.batchSession.setAll in the staircase component and jatos.batchSession.get in the experiment component and worked fine. My study is longitudinal, then the plan is giving to each participant a different link . This batch solution has the same problem you addressed here ("there can be concurrency issues if two study runs write into the batch session at the same time") in my case?

Best!

María

Elisa Filevich

unread,
Oct 11, 2020, 4:36:02 PM10/11/20
to JATOS
Hi María, 

All participants in the same study batch share the same bath session data, so giving people a different link will not affect this. 
If your study is longitudinal and you need to store data from one session to the next, then the batch session data is what you need
If you just want to share data between components, I would use the study session data, which really should work (because, to answer your specific question: yes, you might also have concurrency issues). Using the study session data in this case is the clean and best solution. If I were you I try to set the study session data. If that doesn't work, have a look at any possible error messages displayed on the Developer Tool's console. If you can't see anything obvious there, you can always send us a minimal example of your study where you can reproduce the problem and we'll figure it out. 

Hope this helps
Elisa


Reply all
Reply to author
Forward
0 new messages