PsychoPy/Pavlocia integration with formr

149 views
Skip to first unread message

Jens Bölte

unread,
Nov 15, 2021, 7:47:15 AM11/15/21
to formr

Hello,

I am trying to integrate PsychoPy/Pavlovia with formr. I managed to jump to Pavlovia from formr and back to formr from Pavlovia. However, I'd like to have two different continuations in formr depending on whether participants finish the experiment or ended it prematurely. To achieve that I use a parameter coming back from Pavlovia url (complete)
  1. experiment completed: https://formr.uni-muenster.de/MorphSem?complete=1
  2. experiment not completed: https://formr.uni-muenster.de/MorphSem?complete=0
I see that the url contains the parameter complete with the value 1 or 0 depending on the exit status of the Pavlovia-experiment in the relevant survey that follows the external link element. However, I am not able to process (access with get complete) this parameter in formr. The survey never contains a value for complete. It is always empty.

I want to use the parameter value in a skip forward element to create the two different outcomes. So how and when do I access a parameter from a Pavlovia url?

Thanks a lot for your help.

Jens


Daniel Gromer

unread,
Nov 22, 2021, 3:10:03 AM11/22/21
to formr
I have the same problem: catching URL parameters during a run does not work. What does work, however, is catching URL parameters in the first item of the first survey of the run.

Colleagues of me had this up and running in previous studies. Maybe some formr update causes this issue?

Ruben Arslan

unread,
Nov 22, 2021, 3:17:03 AM11/22/21
to Daniel Gromer, formr
Hi all,

This should work. Can you send a minimal reproducible example for us to investigate?

Best,

Ruben

--
You received this message because you are subscribed to the Google Groups "formr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to formr+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/formr/e2beb22e-52ce-4549-b732-38559381247bn%40googlegroups.com.

Daniel Gromer

unread,
Nov 22, 2021, 5:33:18 AM11/22/21
to formr
Here's a minimal examples with the the survey files and run file attached: https://get-url-param-test.formr.org/
get_url_param_test_get.xlsx
get-url-param-test.json
get_url_param_test_hello.xlsx

Mario Reutter

unread,
Nov 22, 2021, 6:37:44 AM11/22/21
to formr

Hi everybody,

The problem seems to be a bit more nuanced than expected: "get <variable>" does work but you cannot condition upon that variable in the same survey with showif. It seems like the showif statement is evaluated before the get statement but the `r <statement>` pieces are evaluated afterwards, creating a highly unintuitive result when combining all three (see attached screenshot).
If I use `is.na(external_check$code)` in a jump element, however, everything works as expected.
As a workaround, I now use a generic text for the survey that checks for the code and I am happy that the jump works as expected :D

Regards,
Marioexternal_check problem.png
external_check-debug.xlsx

Mario Reutter

unread,
Nov 22, 2021, 6:43:08 AM11/22/21
to formr
P.S.: I'm 100% confident that this used to work a bit more than 1 year ago

Ruben Arslan

unread,
Nov 22, 2021, 6:44:51 AM11/22/21
to Mario Reutter, formr
Hi Mario,

this is at the beginning of the run right? The simplest way to block people without a code from participating is setting the get item to required (! in the optional column) and putting a text in the label column for the get item that informs them that they don't have the code. Then, they can't continue without. However, this is only possible since recent versions and before that the roundabout approach with the SkipForward was needed.

However, I suspect there is a separate problem when doing this within a run, i.e. I can reproduce Daniel's problem.

Best wishes,

Ruben

Mario Reutter

unread,
Nov 22, 2021, 6:54:24 AM11/22/21
to formr
Hi Ruben,

No, this is in the middle of the run. Sorry for not attaching the JSON-file right away.
(Please note that the Pavlovia link won't work because it is in piloting mode and the token has expired)

Kind regards,
Mario
different-faces.json

Ruben Arslan

unread,
Nov 22, 2021, 7:04:54 AM11/22/21
to Mario Reutter, formr
Ah, but in the example by Daniel, there was no showif and I still couldn't get the param. You're able to get the param?
Can you show me a reprex? That'd help me fix this quicker.

Mario Reutter

unread,
Nov 22, 2021, 9:01:50 AM11/22/21
to formr
Here it is:  https://get-param-weirdness.formr.org

showif does not work correctly (using the parameter directly in the same survey) but the checks work that use survey$param.
get-param-weirdness.json

Daniel Gromer

unread,
Nov 22, 2021, 9:40:02 AM11/22/21
to formr
I think I've got the problem: the difference between Mario's run and mine is that the "label" cell in my "get testparam" row is empty. If I add some nonsense to it (like "test"), it works ...

Mario Reutter

unread,
Nov 22, 2021, 9:56:10 AM11/22/21
to formr
Well, that was totally intentional and did not just randomly happen because I modified someone else's template :'D

So, we got one problem down but there is still the (kinda cosmetic) one that conditioning on a variable with showif that was read in the same survey with `get param` does not work.
(Ofc, you can just split into two surveys - one that just reads and one that explicitly references it within showif with survey$param)

Ruben Arslan

unread,
Nov 22, 2021, 2:27:14 PM11/22/21
to Mario Reutter, formr
I agree this all is weird and unintuitive, but glad that you found a "fix". 
I lodged an issue here to tackle in the next release, but slightly less urgent now that you a way..

Jens Bölte

unread,
Nov 23, 2021, 5:28:26 AM11/23/21
to formr
Hello everybody,

cool, solved my problem.

Best wishes Jens
Reply all
Reply to author
Forward
0 new messages