Can I reset the {SAVEDID} so it starts again at 1 after I delete all responses?

More
4 years 1 month ago #92669 by guelphpeter
Hi everyone,
I'm on an older version of LimeSurvey (1.91+ build 11804) but hopefully someone may know how to do this for this version.

I need to reset the {SAVEDID} for a survey, to start again at 1, after I've deleted all the survey's responses. I wonder if someone knows how to do this please?

I've deleted all the survey's responses in its lime_survey_xxxxx database table (where xxxxx is the SID) but when I add a new response to the survey the {SAVEDID} continues incrementing from its last value (i.e. it doesn't get reset to 1 even though I've deleted all responses in the table).

Just wondering if there's another table somewhere where the last value of {SAVEDID} is kept for a survey, or if there's something else I have to do to get {SAVEDID} reset to 1 after I delete all responses.

Thanks in advance for any help and/or suggestions.

Peter

Please Log in to join the conversation.

More
4 years 1 month ago #92681 by DenisChenu
hello,

Deactivate and reactivate the survey : the survey table are created again, and the counter is set to 0.

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 .

Please Log in to join the conversation.

More
4 years 1 month ago #92682 by holch
Just out of curiosity, why do you need to reset the ID?

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

Please Log in to join the conversation.

More
4 years 1 month ago #92689 by guelphpeter
Thanks for this advice Denis - really appreciated.

I tried it (deactivated survey, then reactivated it) and even though the table was created again the {SAVEDID} continues to increment form its previous value i.e. it does not reset to 1.

Very odd indeed. I'm wondering if the {SAVEDID} is stored in another table somewhere ? I've looked everyone but can't find it. If you have any other suggestions I'd be grateful for what to try next.

Peter

Please Log in to join the conversation.

More
4 years 1 month ago #92691 by guelphpeter
Hi Holch,

it's a bit complicated to explain.

Basically I need to know in my main survey, what respondent number is taking the survey (i.e. 1st respondent, 2nd respondent, etc.). The "respondent number" is then used in conditions set on various questions so different respondents see different questions. I do this with a token table in this main survey, where the tokens are 1,2,3,4,5,6,.. etc. i.e. I use the "token" as the respondent number, and attribute_1, attribute_2, ... etc. to determine which questions should be shown for this specific respondent. So far, so good.

Where I'm struggling is I have a first and very simple survey, that simply passes its {SAVEDID} to the second survey as the second survey's token. It's this first survey I need to be able to reset the {SAVEID} back to 1 so that after testing is completed it will start invoking the main survey passing in 1 as the first respondent, 2 as the 2nd respondent, etc.

Hope the above makes sense,

Peter

Please Log in to join the conversation.

More
4 years 1 month ago #92692 by holch
Hmmm, I think I get what you try to do. So in the main survey basically everyone gets different questions (or could get different questions) in terms of in which order they responded the first survey?

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

Please Log in to join the conversation.

More
4 years 1 month ago #92698 by guelphpeter
Yes, that's exactly correct - and a great job of interpreting my babbling about what I'm trying to do <grin>

About the only way I know to do this is have the "first survey" tell the "second i.e. main survey" what respondent this is, but passing the "second survey" the {SAVEDID} in the END URL. The "second survey" treats this {SAVEDID} as the token.

Now if I can only figure out how to reset the {SAVEDID} in that first survey <grin>

Peter

Please Log in to join the conversation.

More
4 years 1 month ago - 4 years 1 month ago #92702 by Ben_V
Hello,
Connect to your LS db using PhpMyAdmin or similar and send the following SQL query:
TRUNCATE TABLE lime_survey_1234
Obviously, replace 'lime_survey' by your correct db_table name...
...and '1234' by your correct survey ID.

Should do the work

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last Edit: 4 years 1 month ago by Ben_V.

Please Log in to join the conversation.

More
4 years 1 month ago #92727 by DenisChenu

guelphpeter wrote: I tried it (deactivated survey, then reactivated it) and even though the table was created again the {SAVEDID} continues to increment form its previous value i.e. it does not reset to 1

Strange,

And you're right.

But maybe test with :
Deactivate survey
Close browser
Reconnect
Reactivate survey.

Because of EM Session ???

Denis
PS: Ben are rigth

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 .

Please Log in to join the conversation.

More
4 years 1 month ago - 4 years 1 month ago #92735 by Ben_V

Because of EM Session

I don't think so because this behaviour was already present in LS versions anterior than 1.92 (1.90)
way back machine

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last Edit: 4 years 1 month ago by Ben_V.

Please Log in to join the conversation.

More
4 years 1 month ago #92846 by guelphpeter
Thanks so much Benoit,

the TRUNCATE did indeed resolve the issue for me - really appreciate your help !

Peter
The following user(s) said Thank You: Ben_V

Please Log in to join the conversation.

More
2 years 4 months ago - 2 years 4 months ago #114664 by mattZee
There is also another workaround if you don't have access to the database.

1. Export the survey structure (you need the surveyname.lss file).

2. Open the *.lss file in an editor and find the line:
<autonumber_start><![CDATA[99]]></autonumber_start>

3. Replace 99 by 1 to start the SAVEDID with 1 or with any other value you like.

4. DELETE the original survey (otherwise the next step will generate a new survey with a NEW SURVEYID)

5. Add a new survey by import and select the manipulated survey.lss file.

DONE.
Last Edit: 2 years 4 months ago by mattZee. Reason: typo

Please Log in to join the conversation.