Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

page start time

Thanks!  I used the page times but they are cumulative so when people are reviewing particular pages or waiting to submit until later, it it not helpful for my purposes.  Is there a way to report out something like the Perl script for a particular page in the export so to know that start time stamp (and not page time) for a particular page?
related to an answer for: time stamp for a page
asked Jun 19, 2021 by sallen Bronze (2,315 points)

1 Answer

0 votes
 
Best answer
If I understand correctly, you want to save the local date / time at a specific question to a variable. Then you want to export that date / time variable later on at the analysis stage. Is that correct?

The below Perl Script should help ...
[%Begin Unverified Perl
 
 my $datestring="";
  
 $datestring=localtime();
 
 SETVALUE("Q1TimeStamp",$datestring);
 
End Unverified%]

In the pass-in fields, define "Q1TimeStamp" as a text data type. Change the  date / time variable name to your preference.

You can place this Perl Script in the footer of the question you want the time stamp recorded at.

Note: You can set as many of these up as necessary.

And refer to this post if you want to extract certain elements of the date / time (e.g. the hour, the month, the date in a short format, etc.) ...

https://legacy.sawtoothsoftware.com/forum/25029/change-text-based-on-time-of-day?show=25029#q25029
answered Jun 19, 2021 by Paul Moon Platinum (98,670 points)
selected Jun 19, 2021 by sallen
Thanks!  If I have pass-in field already would this matter?  I will try this out next week and see how it goes. Thanks again.
Just replace "Q1TimeStamp" with your variable name.

And remember if you do not want the full date / time, you can use that post I provided to allow you to extract elements of the date / time or specific formats. I provided an example where you extract the HOUR only.
Thanks.  In the Perl script would it just be the question name or the name in the Pass-In field? (so L1 or L1TimeStamp)?
I am getting an Error #269 just before the page where this Perl script was added.
[%Begin Unverified Perl
  
 my $datestring="";
   
 $datestring=localtime();
  
 SETVALUE("L1",$datestring);
  
End Unverified%]
You need to set the value to the pass-in field, not the question.

I spotted this old post too regarding error 269 ...

https://legacy.sawtoothsoftware.com/forum/10311/sawtooth-error-%23269?show=10646#a10646
Thanks. So it would be this if L1TimeStamp is my pass-in name?
[%Begin Unverified Perl
   
 my $datestring="";
    
 $datestring=localtime();
   
 SETVALUE("L1TimeStamp",$datestring);
   
End Unverified%]
Yes, that is correct, providing you have the name of the pass-in field the same.

Do a test and see that L1TimeStamp capture the data string correctly.
...