<div dir="ltr">Hi David, <div><br></div><div>Thanks for your reply! And you are totally right, multiple-dimension array is the right way to go. </div><div>Can't believe I normally work in Matlab and didn't think of that... </div><div><br></div><div><br></div><div><br></div><div><br></div><div><br><br>On Friday, 7 February 2014 18:11:17 UTC+1, McFarlane, David wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Um, I am missing something here. Why not use an ordinary
<br>multiple-dimension array to hold all the answers to all the questions, e.g.,
<br>
<br> Const nQuestions as Integer = 4
<br> Const nAnswersMax as Integer = 10
<br> Dim Answers( nQuestions, nAnswersMax )
<br>
<br>and then just use an array index to get the answers for the selected
<br>question? If you need to get fancier, you might use a User Defined
<br>Type (akin to Structures or Records in other programming languages,
<br>look it up in the E-Basic Help facility), perhaps using an array of your UDTs.
<br>
<br>To answer your initial question, if you study the Rte, RteCollection,
<br>and related topics in the E-Basic Help, you just might devise a way
<br>to manage *object* variables with arbitrary names from strings, but
<br>still not manage ordinary variables. Even then, I think it generally
<br>best to adapt techniques according to the tools at hand, which brings
<br>me back to ordinary multiple-dimension arrays in VBA/E-Basic.
<br>
<br>-----
<br>David McFarlane
<br>E-Prime training
<br>online: <a href="http://psychology.msu.edu/Workshops_Courses/eprime.aspx" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fpsychology.msu.edu%2FWorkshops_Courses%2Feprime.aspx\46sa\75D\46sntz\0751\46usg\75AFQjCNHhJVD3mCfXKdywfB5AgKLPu1OSJg';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fpsychology.msu.edu%2FWorkshops_Courses%2Feprime.aspx\46sa\75D\46sntz\0751\46usg\75AFQjCNHhJVD3mCfXKdywfB5AgKLPu1OSJg';return true;">http://psychology.msu.edu/<wbr>Workshops_Courses/eprime.aspx</a>
<br>Twitter: @EPrimeMaster (<a href="https://twitter.com/EPrimeMaster" target="_blank" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Ftwitter.com%2FEPrimeMaster\46sa\75D\46sntz\0751\46usg\75AFQjCNHlT7nwYBmELwRxV4Xn5GW-sG9EKw';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Ftwitter.com%2FEPrimeMaster\46sa\75D\46sntz\0751\46usg\75AFQjCNHlT7nwYBmELwRxV4Xn5GW-sG9EKw';return true;">https://twitter.com/<wbr>EPrimeMaster</a> )
<br>
<br>/----
<br>Stock reminder: 1) I do not work for PST. 2) PST's trained staff
<br>take any and all questions at <a href="https://support.pstnet.com" target="_blank" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fsupport.pstnet.com\46sa\75D\46sntz\0751\46usg\75AFQjCNF5BfukPzW6lq7UCweMsMu7_9wJEQ';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fsupport.pstnet.com\46sa\75D\46sntz\0751\46usg\75AFQjCNF5BfukPzW6lq7UCweMsMu7_9wJEQ';return true;">https://support.pstnet.com</a> , and they
<br>strive to respond to all requests in 24-48 hours, so make full use of
<br>it. 3) In addition, PST offers several instructional videos on their
<br>YouTube channel (<a href="http://www.youtube.com/user/PSTNET" target="_blank" onmousedown="this.href='http://www.youtube.com/user/PSTNET';return true;" onclick="this.href='http://www.youtube.com/user/PSTNET';return true;">http://www.youtube.com/user/<wbr>PSTNET</a> ). 4) If you do
<br>get an answer from PST staff, please extend the courtesy of posting
<br>their reply back here for the sake of others.
<br>\----
<br>
<br>
<br>At 2/7/2014 11:02 AM Friday, Kerwin Olfers wrote:
<br>>I was wondering if there is a way to take a string from an attribute
<br>>and use it as a variable/array name in inline?
<br>>
<br>>My situation:
<br>>
<br>>Participants are prompted with a questions and asked to type their
<br>>answer (which is displayed using the echo functions).
<br>>There are multiple correct answers per question. I know in Eprime
<br>>2.0.10 and up you can simple have the multiple answer
<br>><<a href="http://www.pstnet.com/support/kb.asp?TopicID=1400" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.pstnet.com%2Fsupport%2Fkb.asp%3FTopicID%3D1400\46sa\75D\46sntz\0751\46usg\75AFQjCNHVGugmQeSkMB66zQrlfaSM7c-H5Q';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.pstnet.com%2Fsupport%2Fkb.asp%3FTopicID%3D1400\46sa\75D\46sntz\0751\46usg\75AFQjCNHVGugmQeSkMB66zQrlfaSM7c-H5Q';return true;">http://www.pstnet.com/<wbr>support/kb.asp?TopicID=1400</a>><wbr>comma separated
<br>>in an attribute list, which would solve all my problems.
<br>>However we're running 2.0.8 with little hope of updating in the near future.
<br>>
<br>>The solution so far is to store the multiple answers for each
<br>>question in separate arrays.
<br>>
<br>>e.g.
<br>>question1(1) = "dog"
<br>>question1(2) = "labrador"
<br>>question2(1) = "fish"
<br>>question2(2)= "tuna"
<br>>
<br>>Then after the question slide, I use an inline to run through the
<br>>array to check if the answer is correct.
<br>>However, since there is a different array for each question, I need
<br>>a way to select the proper array, which hopefully doesn't involve me
<br>>putting a whole list of 'if' statements.
<br>>
<br>>Something like:
<br>>
<br>>For Counter = 1 to Ubound(c.getAttrib("arrayName"<wbr>))
<br>> If c.getAttrib("arrayName")(<wbr>Counter) = Stimulus.RESP then
<br>> Stimulus.ACC = 1
<br>> end if
<br>>next
<br>>
<br>>.. although the above obviously doesn't work in the current form.
<br>>Does anyone know of a way to do this, i.e. use strings stored in
<br>>attributes as variable names in inline (a bit like an eval function)?
<br>>
<br>>Thanks!
<br>
<br></blockquote></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups "E-Prime" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+unsubscribe@googlegroups.com.<br />
To post to this group, send email to e-prime@googlegroups.com.<br />
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/e-prime/801e2848-7e1e-4645-8542-4488b2f716d5%40googlegroups.com">https://groups.google.com/d/msgid/e-prime/801e2848-7e1e-4645-8542-4488b2f716d5%40googlegroups.com</a>.<br />
For more options, visit <a href="https://groups.google.com/groups/opt_out">https://groups.google.com/groups/opt_out</a>.<br />