Millisecond Forums

running multiple scripts based on participants choice

https://forums.millisecond.com/Topic23921.aspx

By RBalas - 2/26/2018

Hey,

I have a study that I want to run in 3 different language versions through Inquisit Web. Those language versions are in separate .iqx files.

So what I need to do is to make participants choose their preferred language and run a relevant version based on their response. I thought about <batch> element stored in a separate file that would be dynamically adapted based on participants language, but I am not sure if it can be done this way. 

Can anyone help me out with that?

To sum up:
- web-based study with language versions in separate scripts
- first step: participants choose their language
- based on that choice a relevant script is run.

Help :)

Robert
By Dave - 2/27/2018

RBalas - Tuesday, February 27, 2018
Hey,

I have a study that I want to run in 3 different language versions through Inquisit Web. Those language versions are in separate .iqx files.

So what I need to do is to make participants choose their preferred language and run a relevant version based on their response. I thought about <batch> element stored in a separate file that would be dynamically adapted based on participants language, but I am not sure if it can be done this way. 

Can anyone help me out with that?

To sum up:
- web-based study with language versions in separate scripts
- first step: participants choose their language
- based on that choice a relevant script is run.

Help :)

Robert

Not sure things can be made to work that way. Definite options are:

Either each script needs to have all languages implemented and selectable like this one: https://www.millisecond.com/download/library/v5/iat/multilanguageiat/iat_multilanguage.iqzip

Alternatively, set up a <batch> script with three conditions -- one per language:

// language 1
<batch>
/ subjects = (1 of 3)
/ groupassignment = groupnumber
/ file = "scripta_language1.iqx"
/ file = "scriptb_language1.iqx"
</batch>

// language 2
<batch>
/ subjects = (2 of 3)
/ groupassignment = groupnumber
/ file = "scripta_language2.iqx"
/ file = "scriptb_language2.iqx"
</batch>

// language 3
<batch>
/ subjects = (3 of 3)
/ groupassignment = groupnumber
/ file = "scripta_language3.iqx"
/ file = "scriptb_language3.iqx"
</batch>

Configure the web experiment to read the groupnumber from a query parameter, let's call the parameter "lang" for the sake of example. Then provide your participants with three separate links, i.e.

To complete the study in language 1, click

https://mili2nd.co/abcd?lang=1

To complete the study in language 2, click

https://mili2nd.co/abcd?lang=2

To complete the study in language 3, click

https://mili2nd.co/abcd?lang=3


Perhaps there is yet another way to do something with conditional <include> elements and/or by leveraging <batch> parameters and values, but I'll have to think about this some more first.
By Dave - 2/27/2018

Dave - Tuesday, February 27, 2018
RBalas - Tuesday, February 27, 2018
Hey,

I have a study that I want to run in 3 different language versions through Inquisit Web. Those language versions are in separate .iqx files.

So what I need to do is to make participants choose their preferred language and run a relevant version based on their response. I thought about <batch> element stored in a separate file that would be dynamically adapted based on participants language, but I am not sure if it can be done this way. 

Can anyone help me out with that?

To sum up:
- web-based study with language versions in separate scripts
- first step: participants choose their language
- based on that choice a relevant script is run.

Help :)

Robert

Not sure things can be made to work that way. Definite options are:

Either each script needs to have all languages implemented and selectable like this one: https://www.millisecond.com/download/library/v5/iat/multilanguageiat/iat_multilanguage.iqzip

Alternatively, set up a <batch> script with three conditions -- one per language:

// language 1
<batch>
/ subjects = (1 of 3)
/ groupassignment = groupnumber
/ file = "scripta_language1.iqx"
/ file = "scriptb_language1.iqx"
</batch>

// language 2
<batch>
/ subjects = (2 of 3)
/ groupassignment = groupnumber
/ file = "scripta_language2.iqx"
/ file = "scriptb_language2.iqx"
</batch>

// language 3
<batch>
/ subjects = (3 of 3)
/ groupassignment = groupnumber
/ file = "scripta_language3.iqx"
/ file = "scriptb_language3.iqx"
</batch>

Configure the web experiment to read the groupnumber from a query parameter, let's call the parameter "lang" for the sake of example. Then provide your participants with three separate links, i.e.

To complete the study in language 1, click

https://mili2nd.co/abcd?lang=1

To complete the study in language 2, click

https://mili2nd.co/abcd?lang=2

To complete the study in language 3, click

https://mili2nd.co/abcd?lang=3


Perhaps there is yet another way to do something with conditional <include> elements and/or by leveraging <batch> parameters and values, but I'll have to think about this some more first.

Okay, having thought this through now, here's a solution based on <batch> parameters and values (cf. https://www.millisecond.com/support/docs/v5/html/howto/batchparameters.htm ).

The batch.iqx file looks like this:

<parameters>
/ lang = 0
</parameters>

<values>
/ lang_selected = 0
</values>

<batch multilang>
/ file = "selectlang.iqx"
/ file = "lang1.iqx"
/ file = "lang2.iqx"
/ file = "lang3.iqx"
/ onscriptend = [
    if (batch.multilang.currentscript == "selectlang.iqx")
    {
        parameters.lang = values.lang_selected;
    }
]
</batch>

We first run a small language selection script, selectlang.iqx, which looks like this

<values>
/ lang_selected = 0
</values>

<block selectlangblock>
/ trials = [1=selectlangpage]
</block>

<surveypage selectlangpage>
/ ontrialend = [
    values.lang_selected = dropdown.selectlangq.response;
]
/ questions = [1=selectlangq]
/ showpagenumbers = false
/ showquestionnumbers = false
</surveypage>

<dropdown selectlangq>
/ caption = "Please select your language:"
/ options = ("Language 1", "Language 2", "Language 3")
/ optionvalues = ("1", "2", "3")
</dropdown>

and then pass the language chosen on to the batch <paramaters> "lang" per

<batch multilang>
/ file = "selectlang.iqx"
/ file = "lang1.iqx"
/ file = "lang2.iqx"
/ file = "lang3.iqx"
/ onscriptend = [
    if (batch.multilang.currentscript == "selectlang.iqx")
    {
        parameters.lang = values.lang_selected;
    }
]

</batch>

The remaining scripts -- lang1.iqx to lang3.iqx, representing the three different languages -- then can check the value of that parameter /onexptbegin to decide if they should run or not. In other words, if the language of the script doesn't match the language chosen / stored in the "lang" parameter, the given script aborts immediately, and the batch moves on to the next (rinse, repeat for the other scripts).

lang1.iqx looks like this

<parameters>
/ lang = 0
</parameters>

<expt>
/ onexptbegin = [
    if (parameters.lang != 1) script.abort(false)
]

/ blocks = [1=myblock]
</expt>

<block myblock>
/ trials = [1=mytrial]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("This is script <%script.filename%>.")
</text>

and lang2.iqx as well as lang3.iqx are set up analogously.

The end result is that only the script(s) matching the language selected in the initial script should be administered. I've attached the full set of example scripts below.

Hope this helps!
By RBalas - 2/27/2018

Dave - Tuesday, February 27, 2018
Dave - Tuesday, February 27, 2018
RBalas - Tuesday, February 27, 2018
Hey,

I have a study that I want to run in 3 different language versions through Inquisit Web. Those language versions are in separate .iqx files.

So what I need to do is to make participants choose their preferred language and run a relevant version based on their response. I thought about <batch> element stored in a separate file that would be dynamically adapted based on participants language, but I am not sure if it can be done this way. 

Can anyone help me out with that?

To sum up:
- web-based study with language versions in separate scripts
- first step: participants choose their language
- based on that choice a relevant script is run.

Help :)

Robert

Not sure things can be made to work that way. Definite options are:

Either each script needs to have all languages implemented and selectable like this one: https://www.millisecond.com/download/library/v5/iat/multilanguageiat/iat_multilanguage.iqzip

Alternatively, set up a <batch> script with three conditions -- one per language:

// language 1
<batch>
/ subjects = (1 of 3)
/ groupassignment = groupnumber
/ file = "scripta_language1.iqx"
/ file = "scriptb_language1.iqx"
</batch>

// language 2
<batch>
/ subjects = (2 of 3)
/ groupassignment = groupnumber
/ file = "scripta_language2.iqx"
/ file = "scriptb_language2.iqx"
</batch>

// language 3
<batch>
/ subjects = (3 of 3)
/ groupassignment = groupnumber
/ file = "scripta_language3.iqx"
/ file = "scriptb_language3.iqx"
</batch>

Configure the web experiment to read the groupnumber from a query parameter, let's call the parameter "lang" for the sake of example. Then provide your participants with three separate links, i.e.

To complete the study in language 1, click

https://mili2nd.co/abcd?lang=1

To complete the study in language 2, click

https://mili2nd.co/abcd?lang=2

To complete the study in language 3, click

https://mili2nd.co/abcd?lang=3


Perhaps there is yet another way to do something with conditional <include> elements and/or by leveraging <batch> parameters and values, but I'll have to think about this some more first.

Okay, having thought this through now, here's a solution based on <batch> parameters and values (cf. https://www.millisecond.com/support/docs/v5/html/howto/batchparameters.htm ).

The batch.iqx file looks like this:

<parameters>
/ lang = 0
</parameters>

<values>
/ lang_selected = 0
</values>

<batch multilang>
/ file = "selectlang.iqx"
/ file = "lang1.iqx"
/ file = "lang2.iqx"
/ file = "lang3.iqx"
/ onscriptend = [
    if (batch.multilang.currentscript == "selectlang.iqx")
    {
        parameters.lang = values.lang_selected;
    }
]
</batch>

We first run a small language selection script, selectlang.iqx, which looks like this

<values>
/ lang_selected = 0
</values>

<block selectlangblock>
/ trials = [1=selectlangpage]
</block>

<surveypage selectlangpage>
/ ontrialend = [
    values.lang_selected = dropdown.selectlangq.response;
]
/ questions = [1=selectlangq]
/ showpagenumbers = false
/ showquestionnumbers = false
</surveypage>

<dropdown selectlangq>
/ caption = "Please select your language:"
/ options = ("Language 1", "Language 2", "Language 3")
/ optionvalues = ("1", "2", "3")
</dropdown>

and then pass the language chosen on to the batch <paramaters> "lang" per

<batch multilang>
/ file = "selectlang.iqx"
/ file = "lang1.iqx"
/ file = "lang2.iqx"
/ file = "lang3.iqx"
/ onscriptend = [
    if (batch.multilang.currentscript == "selectlang.iqx")
    {
        parameters.lang = values.lang_selected;
    }
]

</batch>

The remaining scripts -- lang1.iqx to lang3.iqx, representing the three different languages -- then can check the value of that parameter /onexptbegin to decide if they should run or not. In other words, if the language of the script doesn't match the language chosen / stored in the "lang" parameter, the given script aborts immediately, and the batch moves on to the next (rinse, repeat for the other scripts).

lang1.iqx looks like this

<parameters>
/ lang = 0
</parameters>

<expt>
/ onexptbegin = [
    if (parameters.lang != 1) script.abort(false)
]

/ blocks = [1=myblock]
</expt>

<block myblock>
/ trials = [1=mytrial]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("This is script <%script.filename%>.")
</text>

and lang2.iqx as well as lang3.iqx are set up analogously.

The end result is that only the script(s) matching the language selected in the initial script should be administered. I've attached the full set of example scripts below.

Hope this helps!

Dave,

Thank you again! It worked excellent.

Robert