Frage

Is it possible to get the last question ID from LimeSurvey's API RemoteControl2? The api docs are here: http://manual.limesurvey.org/RemoteControl_2_API#add_group

I am importing questions by converting user input to XML then Base64 then sending them and it works ok. Question ID is autoincremented across all surveys. It's filled automatically, but not for parent_qid for subquestions. That needs to be set specifically, otherwise the subquestions get attached to another parent question.

So what I do now is with API methods, I iterate over all the surveys, then groups, then questions and try to find the latest qid. I don't want to create and remove questions (which probably is better in terms of performance but I don't fancy the database mess).

Is there a better way to do it?

War es hilfreich?

Lösung

Ok, to answer my own question (solved by accident): it seems that when adding subquestions, the question id qid needs to be provided, but it doesn't need to be correct - just the correct order will do.

That is, the parent question can have a qid = 1 then the subquestions can have qid = 1 + i

it's important that when adding subquestions from scale X and scale Y, they all need to have the correct order; so

for Y it'll be qid = 1 + i, and for X it will be qid = ySubQ.length + 1 + i

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top