Welcome to the LimeSurvey Community Forum

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

Import multiple question groups at once

  • ZioPaolo
  • ZioPaolo's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 5 months ago #207360 by ZioPaolo
Import multiple question groups at once was created by ZioPaolo
Good morning,

I would like to know if there is a way to use the "import question group from file" feature and import more than one question group in a single operation.

Should I investigate more about importing more files (repeat import job over a list of files) or I can arrange a valid xml containing more than one group?

It is annoying right now that I have a relevance equation into group2 referring to a question in group1 and after making group-by-group export and import into antoher survey, this relevance equation get corrupted.

Thanks

Using LimeSurvey Version 3.24.3+201027
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 5 months ago - 3 years 5 months ago #207372 by tpartner
Replied by tpartner on topic Import multiple question groups at once

I would like to know if there is a way to use the "import question group from file" feature and import more than one question group in a single operation.

No, not with the core code.

It is annoying right now that I have a relevance equation into group2 referring to a question in group1 and after making group-by-group export and import into antoher survey, this relevance equation get corrupted.

This should not happen if using question codes in your relevance equations. Can you give an example?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 3 years 5 months ago by tpartner.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • ZioPaolo
  • ZioPaolo's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 5 months ago #207390 by ZioPaolo
Replied by ZioPaolo on topic Import multiple question groups at once
I prepared a minimal working example.

I attach here the SOURCE survey "

File Attachment:

File Name: limesurvey...URCE.lss
File Size:30 KB
" that is working as expected.

Following these steps:
  1. Create a new DESTINATION survey by copying the SOURCE one
  2. Test DESTINATION survey: OK works as exepected (logic file has no errors)
  3. Delete all question groups from DESTINATION survey
  4. Export Group1 and Group2 from SOURCE survey (files

    File Attachment:

    File Name: limesurvey...oup1.lsg
    File Size:5 KB
    and

    File Attachment:

    File Name: limesurvey...oup2.lsg
    File Size:10 KB
    )
  5. Import (in this order) Group1 and Group2 into DESTINATION survey
  6. Test DESTINATION survey: KO (logic file has errors)
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 5 months ago #207391 by Joffm
Replied by Joffm on topic Import multiple question groups at once
As you used the "outdated" condition builder instead of Expression Manager in your relevance equations, you are right.

You should change this.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 5 months ago - 3 years 5 months ago #207394 by tpartner
Replied by tpartner on topic Import multiple question groups at once
Yep.

This should not happen if using question codes in your relevance equations.


Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 3 years 5 months ago by tpartner.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • ZioPaolo
  • ZioPaolo's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 5 months ago #207403 by ZioPaolo
Replied by ZioPaolo on topic Import multiple question groups at once
Thanks for your time to analyse this.

Just a clarification because I'm a beginner with LimeSurvey: usage of Expression Manager is possible with my version of LimeSurvey (I'm on CE, Version 3.24.3+201027)?
To "use expression manager" means to define the relevance equation "by hand" while editing the single question, right?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 5 months ago #207404 by tpartner
Replied by tpartner on topic Import multiple question groups at once
That's correct. After a little practice, you will find it far faster and more flexible than the conditions designer.The conditions designer is a legacy from versions before Expression Manager (ExpressionScript) was introduced.

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: DenisChenu
The topic has been locked.
  • ZioPaolo
  • ZioPaolo's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 5 months ago #207727 by ZioPaolo
Replied by ZioPaolo on topic Import multiple question groups at once
Following your suggestions I modified the survey by removing all conditions previously defined with the condition builder and I put the relevance equations that I need directly by editing questions themselves and groups.

Now I encountered another issue because if I import multiple times a group (the second one in my previous MWE) having his own conditions based on question codes, the whole behaviour is messy because question codes are not anymore unique.

How can I limit the "scope" of a question code only to the containing group?
There is any other way to solve this?
I really need to automatize survey creation without broking the logic.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 5 months ago #207745 by Joffm
Replied by Joffm on topic Import multiple question groups at once
You should have provided the lss export of your survey and a lsg export of the group you want to import several times.
Please do not force us to create your scenario from scratch
Ease the life of us volunteers.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • ZioPaolo
  • ZioPaolo's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 5 months ago #207752 by ZioPaolo
Replied by ZioPaolo on topic Import multiple question groups at once
Dear Joffm,

you are right and I totally agree. Volunteers are priceless.

Here I attached a (hopefully) self-explanatory example survey.
I also attached the group I need to multiply several times.

Try to import it only once and you will see the expected behaviour.
Then try to import 3 times and you will see the issue that navigating group by group some questions are hidden uncorrectly.
When you arrive to "SUBMIT", only then will appear a validation message and the flows goes back in a lazy way.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 5 months ago #207758 by Joffm
Replied by Joffm on topic Import multiple question groups at once

the whole behaviour is messy because question codes are not anymore unique.


Exactly.
This is usual behaviour. The feature to import groups is not made for this idea.

But in your case a workaround is really easy.
As you use question codes like
"Group2Question1"
"Group2Question2"
...

you only have to change "Group2" to "Group3", import, change to "Group4", import, etc.
This can be done by a small makro in the text editor,
or maybe better create a small program to do this and import by the API.

Sorry, no other idea.
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 5 months ago #207764 by DenisChenu
Replied by DenisChenu on topic Import multiple question groups at once
An alternative can be :
1. Export as TSV
2. Remove the 1st column (id) that broke easy update
3. Copy the lines you need
4. Update the code
5. Import TSV agin.

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.

Lime-years ahead

Online-surveys for every purse and purpose