Inquisit Web - Final page - redirect to a url only if the participant complete the experiment


Inquisit Web - Final page - redirect to a url only if the participant...
Author
Message
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: 13K, Visits: 104K
Dave - 7/11/2022
jxb - 7/11/2022
Where I am getting stuck is how to utilize an if statement in /onscriptend to redirect them only if they get to the last file on the batch script.

In the attached script "redirect_expt.iqx" I am able to have it only redirect to that url if they get through all blocks using equations in <block redirect> and /onexptend.

But in the attached script "00_batch.iqx" it redirects to that url regardless of if I got through all of the files or not when I put a similar if statement in /onscriptend. I tried to <include > the last final as well but it still isn't working properly.

I hope this better explains where I am stuck.

<include> or <summarydata> elements have no place in a batch script, so I'm not sure what this is supposed to do in the first place.

> Where I am getting stuck is how to utilize an if statement in /onscriptend to redirect them only if they get to the last file on the batch script.

If that's all you want, then it's as simple as

<defaults >
/ quitcommand = (Ctrl+36)
</defaults>

<batch 1>
/ file = "panas-10.iqx"
/ file = "redirect_test.iqx"
/ onscriptend = [
    if (batch.1.currentscript == "redirect_test.iqx") {
        defaults.finishpage="https://www.welcome.miami.edu";
    };
]
</batch>


And if you want to get more elaborate, you can alternatively or in addition work with batch values and parameters ( https://www.millisecond.com/support/docs/v5/html/howto/batchparameters.htm ). See the attached example files.

Attachments
examplebatch.iqx (147 views, 366 bytes)
a.iqx (142 views, 558 bytes)
b.iqx (137 views, 558 bytes)
c.iqx (141 views, 558 bytes)
abuvar
abuvar
New Member (28 reputation)New Member (28 reputation)New Member (28 reputation)New Member (28 reputation)New Member (28 reputation)New Member (28 reputation)New Member (28 reputation)New Member (28 reputation)New Member (28 reputation)
Group: Forum Members
Posts: 2, Visits: 12
Hello,
I have a similar issue. We are running a web experiment and those who finished a valid GNAT get redirected to a url (I use the Finish page/redirect to an external web site for that). However, those who did not have valid scores for the GNAT get redirected to another url. 
We created a trial and a block for the latter case:
<trial failed>
/ ontrialend= [if ( values.failed == 1 ) defaults.finishpage = "https://tgm.mobi/status/scr?id=${e://Field/id}/";
script.abort();]
/ skip = [
        if ( values.failed == 0 )
]
<block failed>
/trials = [1 = failed]
/skip = [expressions.AA_dprime > 0 && expressions.AB_dprime > 0]
</block>

Then, the experiment goes like this:
<expt>
/ blocks = [
    1 = trainingStart;
    2-4 = random (attributeA_responsetimeout1, attributeB_responsetimeout1, TargetA_responsetimeout1);
    5 = testStart;
  6-7 = random(TargetAattributeA_responsetimeout2, TargetAattributeB_responsetimeout2);
  8 = speedup;
  9-10 = random(TargetAattributeA_responsetimeout3, TargetAattributeB_responsetimeout3);
    11 = failed;
    12 = end
    ]
/ preinstructions = (begin1, begin2, begin3)
</expt>
If I test the experiment and I do not get a valid GNAT, I get the right "failed" message, but unfortunately, I am redirected to the page as if I had a valid GNAT.
Could you help me on this?
Thanks!







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: 13K, Visits: 104K
abuvar - 11/10/2022
Hello,
I have a similar issue. We are running a web experiment and those who finished a valid GNAT get redirected to a url (I use the Finish page/redirect to an external web site for that). However, those who did not have valid scores for the GNAT get redirected to another url. 
We created a trial and a block for the latter case:
<trial failed>
/ ontrialend= [if ( values.failed == 1 ) defaults.finishpage = "https://tgm.mobi/status/scr?id=${e://Field/id}/";
script.abort();]
/ skip = [
        if ( values.failed == 0 )
]
<block failed>
/trials = [1 = failed]
/skip = [expressions.AA_dprime > 0 && expressions.AB_dprime > 0]
</block>

Then, the experiment goes like this:
<expt>
/ blocks = [
    1 = trainingStart;
    2-4 = random (attributeA_responsetimeout1, attributeB_responsetimeout1, TargetA_responsetimeout1);
    5 = testStart;
  6-7 = random(TargetAattributeA_responsetimeout2, TargetAattributeB_responsetimeout2);
  8 = speedup;
  9-10 = random(TargetAattributeA_responsetimeout3, TargetAattributeB_responsetimeout3);
    11 = failed;
    12 = end
    ]
/ preinstructions = (begin1, begin2, begin3)
</expt>
If I test the experiment and I do not get a valid GNAT, I get the right "failed" message, but unfortunately, I am redirected to the page as if I had a valid GNAT.
Could you help me on this?
Thanks!







Things work a bit differently under Inquisit 6, which is what you're using. To make this work, you'll want to do the following.

(1) In the web experiment's settings, leave the finish page settings at their default, i.e.



(2) In the script, first thing you do /onexptbegin is set defaults.finishpage to the URL you normally want participants be redirected to;

<expt>
/ onexptbegin = [
    defaults.finishpage = "https://www.example.com/"; // your actual URL here
]
/ blocks = [
    1 = trainingStart;
    2-4 = random (attributeA_responsetimeout1, attributeB_responsetimeout1, TargetA_responsetimeout1);
    5 = testStart;
  6-7 = random(TargetAattributeA_responsetimeout2, TargetAattributeB_responsetimeout2);
  8 = speedup;
  9-10 = random(TargetAattributeA_responsetimeout3, TargetAattributeB_responsetimeout3);
    11 = failed;
    12 = end
    ]
/ preinstructions = (begin1, begin2, begin3)
</expt>


You need not worry about URL parameters here, any parameters that come in to the experiment's start page will be automatically added to that URL upon redirection.

(3) In the code as you have it, you can then override the finishpage set /onexptbegin if a participant fails to perform adequately.

<block failed>
/trials = [1 = failed]
/skip = [expressions.AA_dprime > 0 && expressions.AB_dprime > 0]
</block>

<trial failed>
/ ontrialend= [if ( values.failed == 1 ) defaults.finishpage = "https://tgm.mobi/status/scr";]
/ skip = [
        values.failed == 0]
/ frames = [1 = failed, exit]
/ correctresponse = (" ")
/ errormessage = false
/ correctmessage = false
/ recorddata = false
</trial>

Edited 2 Years Ago by Dave
abuvar
abuvar
New Member (28 reputation)New Member (28 reputation)New Member (28 reputation)New Member (28 reputation)New Member (28 reputation)New Member (28 reputation)New Member (28 reputation)New Member (28 reputation)New Member (28 reputation)
Group: Forum Members
Posts: 2, Visits: 12
Thanks a lot Dave, it is working!
Edited 2 Years Ago by 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