interpolating text in captions


Author
Message
brendan
brendan
Partner Member (810 reputation)Partner Member (810 reputation)Partner Member (810 reputation)Partner Member (810 reputation)Partner Member (810 reputation)Partner Member (810 reputation)Partner Member (810 reputation)Partner Member (810 reputation)Partner Member (810 reputation)
Group: Forum Members
Posts: 8, Visits: 25
Hi,

I am trying to create reusable code where I can use the same survey items multiple times with varying text. Basically, I want to ask people the same question several times, but change the subject of question each time. Below is a basic code example of what I am trying to do. The first part creates a set of associated pairs ("y1", "x1") etc. Then I want to interpolate those values as text into captions (and potentially other places). So in the example below I want occurrences of YYY to use item_y and XXX to use item_x.

I tried something similar to the percent interpolation in this link but it did not work:

http://www.millisecond.com/support/docs/v5/html/language/properties/caption.htm

Is there another way to do this or some way to tweak what I have?

Thanks!

<item items_y>
/ 1 = "y1"
/ 2 = "y2"
/ 3 = "y3"
</item>

<item items_x>
/ 1 = "x1"
/ 2 = "x2"
/ 3 = "x3"
</item>

<text text_y>
/ items = items_y
/ select = sequence
</text>

<text text_x>
/ items = items_x
/ select = text.text_y.currentindex
</text>

<expt some_expt>
/ blocks = [1=someblock;]
</expt>

<block someblock>
/ trials = [1-3=some_survey]
</block>

<surveypage some_survey>
/ questions = [1=some_caption; 2=some_textbox_x; 3=some_textbox_y;]
</surveypage>

<caption some_caption>
/ caption = "caption caption XXX caption caption YYY"
</caption>

<textbox some_textbox_x>
/ caption = "What is XXX?"
/ mask = decimal
/ required = false
</textbox>

<textbox some_textbox_y>
/ caption = "What is YYY?"
/ mask = decimal
/ required = false
</textbox>


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: 105K
brendan - Thursday, June 29, 2017
Hi,

I am trying to create reusable code where I can use the same survey items multiple times with varying text. Basically, I want to ask people the same question several times, but change the subject of question each time. Below is a basic code example of what I am trying to do. The first part creates a set of associated pairs ("y1", "x1") etc. Then I want to interpolate those values as text into captions (and potentially other places). So in the example below I want occurrences of YYY to use item_y and XXX to use item_x.

I tried something similar to the percent interpolation in this link but it did not work:

http://www.millisecond.com/support/docs/v5/html/language/properties/caption.htm

Is there another way to do this or some way to tweak what I have?

Thanks!

<item items_y>
/ 1 = "y1"
/ 2 = "y2"
/ 3 = "y3"
</item>

<item items_x>
/ 1 = "x1"
/ 2 = "x2"
/ 3 = "x3"
</item>

<text text_y>
/ items = items_y
/ select = sequence
</text>

<text text_x>
/ items = items_x
/ select = text.text_y.currentindex
</text>

<expt some_expt>
/ blocks = [1=someblock;]
</expt>

<block someblock>
/ trials = [1-3=some_survey]
</block>

<surveypage some_survey>
/ questions = [1=some_caption; 2=some_textbox_x; 3=some_textbox_y;]
</surveypage>

<caption some_caption>
/ caption = "caption caption XXX caption caption YYY"
</caption>

<textbox some_textbox_x>
/ caption = "What is XXX?"
/ mask = decimal
/ required = false
</textbox>

<textbox some_textbox_y>
/ caption = "What is YYY?"
/ mask = decimal
/ required = false
</textbox>


Easiest way to do this is to use two linked <list>s:

<list items_x>
/ items = ("x1", "x2", "x3")
/ selectionmode = sequence
</list>

<list items_y>
/ items = ("y1", "y2", "y3")
/ selectionmode = list.items_x.currentindex
</list>

<expt some_expt>
/ blocks = [1=someblock;]
</expt>

<block someblock>
/ trials = [1-3=some_survey]
</block>

<surveypage some_survey>
/ questions = [1=some_caption; 2=some_textbox_x; 3=some_textbox_y;]
</surveypage>

<caption some_caption>
/ caption = "caption caption <%list.items_x.nextvalue%> caption caption <%list.items_y.nextvalue%>"
</caption>

<textbox some_textbox_x>
/ caption = "What is <%list.items_x.currentvalue%>?"
/ mask = decimal
/ required = false
</textbox>

<textbox some_textbox_y>
/ caption = "What is <%list.items_y.currentvalue%>?"
/ mask = decimal
/ required = false
</textbox>


brendan
brendan
Partner Member (810 reputation)Partner Member (810 reputation)Partner Member (810 reputation)Partner Member (810 reputation)Partner Member (810 reputation)Partner Member (810 reputation)Partner Member (810 reputation)Partner Member (810 reputation)Partner Member (810 reputation)
Group: Forum Members
Posts: 8, Visits: 25
Thanks! That's perfect.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search