Date problem - find number of days since last survey

More
3 years 17 hours ago #115440 by Maris
Maris created the topic: Date problem - find number of days since last survey
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.

Please Log in to join the conversation.

More
3 years 16 hours ago #115441 by holch
holch replied the topic: Date problem - find number of days since last survey
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'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds
The following user(s) said Thank You: Maris

Please Log in to join the conversation.

More
3 years 15 hours ago #115446 by tpartner
tpartner replied the topic: Date problem - find number of days since last survey
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

Please Log in to join the conversation.

More
3 years 3 hours ago #115458 by Mazi
Mazi replied the topic: Date problem - find number of days since last survey
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
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"
The following user(s) said Thank You: Maris

Please Log in to join the conversation.

More
3 years 3 hours ago #115462 by tpartner
tpartner replied the topic: Date problem - find number of days since last survey
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.

Please Log in to join the conversation.

More
3 years 2 hours ago #115463 by Mazi
Mazi replied the topic: Date problem - find number of days since last survey
Yep


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
3 years 1 hour ago - 3 years 1 hour ago #115466 by Maris
Maris replied the topic: Date problem - find number of days since last survey
Ah. Thank you. Heavy programming... hmmmm... might need a jack for this. :blink:
Thank you again. I might will likely be back with more questions.
Last Edit: 3 years 1 hour ago by Maris.

Please Log in to join the conversation.

More
2 years 11 months ago - 2 years 11 months ago #115491 by DenisChenu
DenisChenu replied the topic: Date problem - find number of days since last survey
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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Last Edit: 2 years 11 months ago by DenisChenu.
The following user(s) said Thank You: Maris

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!