Welcome to the LimeSurvey Community Forum

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

How can I get using the API the questions and answers in the right order?

  • mike01
  • mike01's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 7 months ago #99335 by mike01
How can I get using the API the questions and answers in the right order?

I am trying to use the list_questions method but by far this is not working fine.

Any help?

Thanks !
The topic has been locked.
More
3 years 10 months ago #198877 by Pharez
Hey man, really late to the party and hope you aren't still stuck on this question just decided to reply as I have been stuck on this for the best part of a week but I now know how to do this. You need to get question properties and groups for this to work. First populate an array with only parent questions and sort the parent questions by group_order - which you can link by using the questions gid property matching in your array of groups. Then sort the sub questions based on their respective question_order but make them separated by parent_qid. Finally, put the sub questions immediately after their respective parents in your now sorted array.
For some reason they seem to sort questions by a mixture of qid and parents but this rarely works as the qid is the order questions were created in and not necessarily the final order the user wanted.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose