Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Time stamp when an individual question is answered

  • ChrisMcD
  • ChrisMcD's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 7 months ago #188810 by ChrisMcD
I am trying to setup a survey which will be completed over several days.

Is it possible to record the exact time when an individual question (or group) was answered ? I know I can see when the whole survey was completed, but I'd like to see the time of one individual question.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago #188811 by holch
This is possible, see here:
manual.limesurvey.org/Activating_a_survey

When you activate the survey, you can set "Save timings" to YES and Limesurvey will record when a "page" has been submitted. You can do this for individual questions only if you use the question by question mode. In the group by group mode you will only be able to do it per group, because it will save the timings when you "submit" a page and go to the next one.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • ChrisMcD
  • ChrisMcD's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 7 months ago #188818 by ChrisMcD
Ah ok thanks for the reply. I was hoping to be able to use Group By Group and somehow get a a timestamp of when a question or if not when a group was completed (e.g. group1 submited at 9.53am).

Looks like this might not be possible
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago #188819 by holch
Hmmm, I am not sure why you say that. I just showed you an option.

Wait, you are referring to timestamps. Maybe that is the issue. Not sure if LS just notes the time itself or the timestamp. Haven't used this feature in quite a while.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • ChrisMcD
  • ChrisMcD's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 7 months ago #188820 by ChrisMcD
Apologies I maybe did not make myself clear.

I have timings switched on and it will currently record how much time a user took to answer a group of questions e.g. Group 4 - 23.24(seconds)

What I would like is to be able to see the exact time of day when a group was completed. So when I export the responses I can see Group4 - 19.23:23
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago #188821 by holch
Just did a quick test on the LS demo site and seems like it is not timestamps that are saved per question, but rather the timing in between.

18,"2019-09-17 01:11:57","2","en","1658867261","2019-09-17 01:11:47","2019-09-17 01:11:57"," demo.limesurvey.org/index.php?r=admin/su....26","","6.91","4.35 "


However, you have the timestamp when the survey was started and you have the last time stamp as well, so you probably could calculate the timestamp per question group based on this.

Or you could write the timestamp into a hidden question (not via GUI, but CSS). I am not sure how this could be done, though. Not an expert on JS.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago - 4 years 7 months ago #188823 by tpartner
Can't test this week but I think you should be able to insert a hidden (via CSS) text question in each group and set the date in those questions with Expression Manager in equation questions. (I think Expression Manager will be fired on page-submit)

Code:
{myHiddenQuestion = date()}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 4 years 7 months ago by tpartner.
The topic has been locked.
  • ChrisMcD
  • ChrisMcD's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 7 months ago - 4 years 7 months ago #188834 by ChrisMcD
Thanks for reply Tony. I saw another suggestion which appears to be similiar to your method. Suggest putting the below, in the source code of a free text box. I assume you leave the box blank, and it it populates with the datetime. ITried the code, but when I export the repsonses, the box was blank.


Code:
<script type="text/javascript" charset="utf-8">  
  $(document).ready(function(){
    if($('#question{QID} input.text').val() == '') {
      $('#question{QID} input.text').val(new Date().getTime());
    }
  });
</script>

Actually I checked and I think it might have been one of your old posts lol
Last edit: 4 years 7 months ago by ChrisMcD. Reason: more info
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago #188836 by holch
Did you hide the question? If so, how?

Always try with the question not hidden first and see what happens. Only when that works, hide the question.

If you hide the question via the GUI (the feature you mentioned before - "Always hide question"), it does not appear in the source code of the questionnaire at all and the JS funcion can not write into it. So for using javacript, you'll need to hide the question via CSS, as Tony described above.

However, if you use the approach via expression manager, you can hide the question via GUI, because expression manager can still write to the question, even if it is not in the html code of the displayed questionnaire.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago #188844 by tpartner
Also, I think you may want to remove the .getTime() function. That will give you epoch time, not a date.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago #188853 by DenisChenu
Unsure, mus be checked but i think you can use (for group 1 here)

1. A text question startTimeG1 (hidden by attribute)
2. A text question lastTimeG1 (hidden by attribute)
3. An equation question setTimeG1 (hidden by attribute)

Equation can be
{startTimeG1=if(is_empty(startTimeG1.NAOK,date("Y-m-d H:i:s"),startTimeG1)}
{lastTimeG1=date("Y-m-d H:i:s")}

startTimeG1 get the 1st seen time
lastTimeG1 get the last seen time (just a microseconds after).

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • ChrisMcD
  • ChrisMcD's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 7 months ago #188857 by ChrisMcD
Hi Tony

The code still doesnt seem to populate a date/time in the response field. The question is hidden and doesnt appear to give any errors.

Any other ideas ?
Code:
<script>
  $(document).ready(function(){
    if($('#question{QID} input.text').val() == '') {
      $('#question{QID} input.text').val(new Date().getTime());
    }
      {
     $('#question{QID}').hide();
  }
  });
</script>

Thanks for the help
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose