Welcome to the LimeSurvey Community Forum

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

Date problem - find number of days since last survey

More
9 years 3 months ago #115440 by Maris
Hi folks.

I'm new to Lime Survey, reading the manual cover-to-cover, but I haven't found a way to do one seemingly innocuous thing.

What I am trying to do is measure the number of days between the day that a person comes to a survey, "today", and the previous day that person did the same survey, "previous".

"today" - "previous" = number of days elapsed.

Should be easy, right?

But HOW on Earth do you find the date a person has completed a survey previously?
I've looked at Tokens, and I might be able to put in a special field for date created, for their initial visit.
But how would I find the difference in days between visit 3 and visit 2, for example.

I guess one thing I need to find out is "Is there a date associated with when a survey is submitted?" "If there is, is there a way to access that information in the build of the survey?"

I'm all adrift here. Please let me know if the situation is unclear or you need more information?

Things you may need to know -
We are following people over time.
They will have the same questions every visit.
We want to know how long it has been since their last survey visit.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 3 months ago #115441 by holch
I don't think that there is any way to get this out of the box in Limesurvey, due to the way that Limesurvey is built.

In the data file you can save the date for each filled questionnaire. But you can't access this information in another questionnaire I think. You can only get this later when you analyze the data.

There might be solutions, but they will most probably involve heavy programming.

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

The following user(s) said Thank You: Maris
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 3 months ago #115446 by tpartner
Holch is correct, there is no built-in method to access data from previous submissions. You will need to make an AJAX call to a remote PHP file that queries the database.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: Maris
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
9 years 3 months ago #115458 by Mazi
Another solution could be placing a cookie on submit and reading that cookie at the next survey start using JS.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The following user(s) said Thank You: Maris
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 3 months ago #115462 by tpartner
Yes, but that assumes the respondent would use the same machine and browser.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
9 years 3 months ago #115463 by Mazi
Yep

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
More
9 years 3 months ago - 9 years 3 months ago #115466 by Maris
Ah. Thank you. Heavy programming... hmmmm... might need a jack for this. :blink:
Thank you again. I [strike]might[/strike] will likely be back with more questions.
Last edit: 9 years 3 months ago by Maris.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 3 months ago - 9 years 3 months ago #115491 by DenisChenu
Think using a:
- Token table not anonymous enable
- No token persistence
- Allow update or infinite answer
- date enabled

After add a plugin : beforeSurveyPage event.
- Look if survey is started (if it's already started: do nothing)
- A start of survey :search for the last submitted entry with this token (find('conditions'=>"token=:token and submitted is not null",'order'=>'id desc','params'=>array(":token"=>$tokenUser)) or somthing like thta).
- Add it somewhere in the survey (a hidden texte question for example (fill the $_SESSION var).
- USing this question in description text of the survey (for example).

Denis

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.
Last edit: 9 years 3 months ago by DenisChenu.
The following user(s) said Thank You: Maris
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose