Welcome to the LimeSurvey Community Forum

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

Copy Survey Not Working - Question Codes

  • Mike1985_2
  • Mike1985_2's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 6 months ago - 9 years 6 months ago #111980 by Mike1985_2
Copy Survey Not Working - Question Codes was created by Mike1985_2
Hi,

I'm having a problem understanding the way LimeSurvey handles copying of surveys/groups/questions.

I have tried to copy an entire survey (having the same issue with importing as well). Although the copy is technically successful, all my subquestions from array type questions have not copied over.

So, as a different approach, I tried to import just a question (an array type with subquestions) on it's own from one survey to another and I get the following error message;
Code:
LimeSurvey
Error
 
The question could not be imported for the following reasons:
 
Question codes must be unique.

Why can't the codes be made unique for me? Do I have to do something differently to get it to work?

Can I turn debugging on and see the SQL query that is being submitted for this?
Last edit: 9 years 6 months ago by Mike1985_2. Reason: Added another question
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 6 months ago #111990 by holch
Replied by holch on topic Copy Survey Not Working - Question Codes
Never had a problem like this.

What version do you work with?

Do you have the same question code for more than one question?

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.
  • Mike1985_2
  • Mike1985_2's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 6 months ago #111994 by Mike1985_2
Replied by Mike1985_2 on topic Copy Survey Not Working - Question Codes
Version 2.05+ Build 140811

The question codes are unique - but obviously once I try to import, it is importing an exact duplicate and therefore there will be duplicate codes.

Am I supposed to go through the .lss files first and change all the codes?
The topic has been locked.
  • fransmarcelissen
  • fransmarcelissen's Avatar
  • Offline
  • Premium Member
  • Premium Member
More
9 years 6 months ago #111996 by fransmarcelissen
Replied by fransmarcelissen on topic Copy Survey Not Working - Question Codes
I do not know whether this is intended behaviour, but indeed, if you import the same question twice, the codes are the same.
What I would do: do not import the question the second time, but copy the (first) question. Then you can/must change the code. Or before import change the code of the first question.
Frans
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 6 months ago #112009 by holch
Replied by holch on topic Copy Survey Not Working - Question Codes
Let us be clear here what you are trying: You try to export a whole survey and import it as a whole new survey, correct? In this case, as long as within the same survey you don't have the same question code twice this should be not a problem. The new survey should receive a new survey code and you should be fine.

I will make a test later.

However, when exporting and importing questions (like fransmacelissen is saying), you need to make sure to give the imported question a different question code to any other question within the survey you are importing to.

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.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 6 months ago - 9 years 6 months ago #112010 by holch
Replied by holch on topic Copy Survey Not Working - Question Codes
Just exported and then imported a survey with the same LS version as you and there are no error messages.

I would assume that there is something wrong with the survey you are trying to import and export.

Can you provide the survey as a download here or is it confidential?

Ahhh, I just had another look at your orginal post, and your export is a question file.

Of course there can't be two questions with the same name. So when you import the question to a survey where there is already a question with this code, you will need to change the code for one of them.

Just tested it and the question is imported without asking for a new question code. This wasn't a problem, because 'q4' did not exist in my test survey. I tried to import it again, which is when I got your error message.

So you have two quick solutions: If you want to have the same question twice in the same survey, don't export/import it, but copy it. Or you need to change the question code for the one that already exists after exporting, so you can import it. Ideally there would be a dialog when importing, so that you can change the question code of the imported question. I think a bug report would be good. But for now you can solve it with the above aproaches.

For importing Surveys this doesn't happen. Might be also a problem for importing groups.

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

Last edit: 9 years 6 months ago by holch.
The topic has been locked.
More
9 years 3 months ago #115381 by cshaw
Replied by cshaw on topic Copy Survey Not Working - Question Codes
Yep, this is an issue for importing groups.

I have the situation where I am asking respondents to enter family health information for my group's research study, so we are asking the same questions over and over again with each family member.

I created a group with health info questions for a family member, thinking I could export and import the group again for the second family member. I can export/import to .lss files, BUT all the references get broken since we are referencing ONLY the question name. It would be really great if LimeSurvey namespaced the questions. That is what we used to do when with had SGQA names. We lost some flexibility going to a user defined name.

It is very tedious to go through and rename EVERY question, so I thought I'd export the whole survey to Excel make the modifications and then upload again. BUT no that doesn't work anymore either. I can't get a survey saved as txt to upload again. Maybe someone else knows a trick I don't.

IT's a little frustrating because I know we used to have that functionality.

I am playing around with different approaches ... but if anyone else has crossed this bridge and KNOWS how to get to the other side I'd appreciate a head's up.

What I am thinking I will try:
- Playing around with different types of export/import
- Try using SGQA names for questions and doing export/import of the group

Carole
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 3 months ago #115397 by DenisChenu
Replied by DenisChenu on topic Copy Survey Not Working - Question Codes
Hi,

I update directly the lsg file for this, for example adding G1 at start of each question. Open with gedit and replace all G1 by G2.

It work, but it's not cool, then you can pit a feature request.

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.
  • fransmarcelissen
  • fransmarcelissen's Avatar
  • Offline
  • Premium Member
  • Premium Member
More
9 years 3 months ago #115400 by fransmarcelissen
Replied by fransmarcelissen on topic Copy Survey Not Working - Question Codes
Extra advice: always make a backup of the db first, before doing this kind of things.
Even more naughty: you can also change the names of the questions and the references also directly in the mysql database. Again: never do this without making a backup first!
Succes!
frans
The following user(s) said Thank You: cshaw
The topic has been locked.
More
9 years 3 months ago #115433 by cshaw
Replied by cshaw on topic Copy Survey Not Working - Question Codes
Ah, great tip!
The topic has been locked.
More
9 years 3 months ago #115439 by cshaw
Replied by cshaw on topic Copy Survey Not Working - Question Codes

Hi,

I update directly the lsg file for this, for example adding G1 at start of each question. Open with gedit and replace all G1 by G2.

It work, but it's not cool, then you can pit a feature request.


Hey I did what you suggest here and it works really slick. I still think the questions should be name-spaced, but this does the trick nicely. I hadn't attempted to modify the lsg file directly before, but that was a synch. LOVE being able to just search/replace. :)
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
9 years 3 months ago #115461 by Mazi
Replied by Mazi on topic Copy Survey Not Working - Question Codes
Guys, please do such changes with care, it could really break your survey so always created backups!

Best tools for using search/replace are Notepad++ (if you want to edit the raw file) and - since the export format is XML based - XML Notepad.

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: cshaw
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose