logging in loop

Leisha Wharfield leisha at decisionresearch.org
Thu May 11 16:12:30 UTC 2006


I've done this a couple of ways. Say I want to keep track of a total 
response time. It's one variable that is just one value, so I would 
write it into the data file. Say I'm going to call the variable 
TotalResponseTime. First I create TotalResponseTime as an attribute, 
probably in the user area of the script. I also create another attribute 
there called Response, which I can use to capture the most recent response:

Dim TotalResponseTime as Integer
Dim Response as Integer

Then every time that Screen1 runs, I add to that variable to Screen1. 
Here's an If command I used in the case where a non-numeric response 
ends the screen displays.

If IsNumeric(Slide1.RESP) Then
    Response = Slide1.RESP
    TotalResponseTime = TotalResponseTime + Response
Else
    c.SetAttrib "TotalResponseTime", TotalResponseTime
End If

The Else clause writes the TotalResponseTime into your data file.

The other method I've used for keeping track of a series of numbers is 
opening an extra text file & appending it as I go. This results in a 
list of numbers--say, for example, a series of responses made by a subject.

Before the slide, I establish a name for the text file, say subject 
number plus R for Response:

Textname = c.GetAttrib("Subject") + "R.txt"

After the slide, I append the response to that filename:

    Open Textname$ For Append as #1
    Write #1,Slide1.RESP
    Close

As far as I know, you may record as many responses as you like this way. 
Hope this helps.

Leisha Wharfield
Decision Research
Eugene, Oregon, USA

Fredrik Ullén wrote:

> Hi,
> I have a script where the same (e.g.) ImageDisplay object is run 
> repeatedly in a loop, i.e.:
>
> Label 1
> ImageDisplay1
> Goto Label 1 (in an InLine object)
>
> I'd like to log some parameters of ImageDisplay1 each time, but the 
> data file seems to be
> overwritten so that only the last instance is left. Is there a solution?
> Thanks!
> Best
> Fredrik
>
>
> Fredrik Ullén
> Associate Professor
> Stockholm Brain Institute
> Dept Woman and Child Health
> Neuropediatric Research Unit (ALB, Q2:07)
> Karolinska Institutet
> SE-171 76 Stockholm
> Sweden
> personal web page www.fredrikullen.com
>
>
>



More information about the Eprime mailing list