Welcome to the LimeSurvey Community Forum

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

Forcing question IDs?

  • caitifty
  • caitifty's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 9 months ago #171411 by caitifty
Forcing question IDs? was created by caitifty
Hi,

I'm planning to set up multiple (>20) small community organizations with their own individual copy of limesurvey (on the same server) to ask an identical questionnaire. Each organization will only be able to look at their own data, but we also want to be able to combine certain data points from each survey. To do this, I'm planning to just write some code to grab the relevant variables from the relevant survey in each individual mysql database. So far, so good.

My question is, is there a way to force the underlying question ID for each question to be the same in every survey? When I copy an lss file from one installation to the next, it assigns new numbers, so 'What's the service date?' might be X10X211 in one database and X34X323 on the next. I can certainly write some sort of master index containing the survey number and the 'local' variable names for every installation, but this would get pretty tedious as the number of installations and number of variables of interest get larger. I was wondering if there's any way to force the question ids (and ideally survey ids) so that 'What's the service date?' is (for example) X10X211 on *every* survey, with only the mysql database name changing from installation to installation?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 9 months ago #171414 by tpartner
Replied by tpartner on topic Forcing question IDs?
The question and group IDs are assigned sequentially so ,as far as I know, you cannot force them.

I'm no SQL expert but how about using the question codes instead of IDs in your queries?

(...or use the API?)

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: caitifty
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 9 months ago #171428 by DenisChenu
Replied by DenisChenu on topic Forcing question IDs?
Quick answer : you can't … really you can't …

Question key are qid + language
Question have sid and gid

Then you can't.

And yes : API is here, or take a look at VV import/export

Else : you can use gitlab.com/SondagesPro/coreAndTools/getQ...surveyCodeHelper.php : return an array for DBcolumn (123X12X1234) to EM question code (Q01)

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 following user(s) said Thank You: caitifty
The topic has been locked.
  • caitifty
  • caitifty's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 9 months ago #171455 by caitifty
Replied by caitifty on topic Forcing question IDs?
Thanks Denis, I think the code you provided will solve my problem by letting me automate identifying the DBcolumn connected to each question code for each installation.

Kind regards

Peter
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
5 years 9 months ago #171476 by LouisGac
Replied by LouisGac on topic Forcing question IDs?
I'd say you can by using a docker container you copy for each organisation.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose