Group Codes Proposal
From LimeSurvey Manual
I'd like to propose that we add a group code (or "slug") to the group table, and that it be used when creating variable names an in the ExpressionScript.
Question groups are a great way to have survey building blocks, either for separate surveys or duplicating a block of questions. But since we now require unique question codes for each question, it's a lot of work to manage that. I propose that question codes be unique within groups, and group codes be unique within surveys.
Group codes could also be used in EM.
group_code (or slug) would be added to groups table, and make into a unique index (survey_id, group_code). During upgrade, we'd need a method to create a group code, either from the current group id (unique), the current order that the group is in with the survey (also unique, and a bit easier to understand) or the group name (checking for duplicates, etc.).
How it Helps
Suppose your survey has to do with children's names and ages. Right now, you'd create a group 'child1' with name and age questions, called child1_name, child1_age. For child 2, you export child1, import it as a new group, then change all the values one at a time. Then change all the conditions one at a time. Then do it again.
With a unique group code, you'd simply have 'name' and 'age' as qcodes, and a group_code of 'child1'. Internally this would map to 'child1_name'. Now when you import the 'child' group, you simply need to change one thing, the group_code, to child2. Now you have unique qcodes.
ExpressionScript would need to change to reflect that some expressions, especially conditions, are within-group only. For example, if you only want to ask the 'school' question if 'age' > 3, you'd need to indicate to EM that 'age' means "Age within this group". If you wanted a specific access, you'd need a format to say "child1.age", when you mean "the first one listed".
Group codes will also make import and exporting surveys easiers, and I'd like to see group_id dropped from everything except very low-level group edit functions.