Welcome to the LimeSurvey Community Forum

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

Limesurvey API download Group timings

  • BBSR-SR5
  • BBSR-SR5's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
18 hours 25 minutes ago #271340 by BBSR-SR5
Replied by BBSR-SR5 on topic Limesurvey API download Group timings

Hi,
if you use SGQA syntax I do not see an issue.

I admit this is php (I have not the least knowledge of python), but I assume that your python code is correct.
Code:
$surveyResponses = $myJSONRPCClient->export_responses(
    $sessionKey,
    $survey_id,
    'json', // Document type : pdf,csv,xls,doc,json
    null, // Language code : null : default from survey
    'complete', // Stautus complete|incomplete|all
    NULL, // Heading : code|full|abbreviated : question text, default code
    NULL, // answer : short|long , default : long
    1,    // From Response ID
    30000,   // To Response ID   
['id', 'submitdate', 'lastpage', 'startlanguage', 'seed', 'startdate', 'datestamp', '758878X3477X42341', '758878X3477X42342SQ001', '758878X3477X42342SQ002', '758878X3477X42342SQ003', '758878X3478X42343', 'interviewtime', '758878X3477time', '758878X3478time']
);

Here the data of the last participant and everything displayed as table


Joffm

 
Thank you very much for your explanation! With this I managed to figure out my problem. This was three fold:
  1. I was trying to retrieve group timings on answer/child question level
  2. I didn't realise I also needed to retrieve answers with the SGQA code, I couldn't use the field name from the json or csv output.
  3. For retrieving answers for sub-questions (like in multiple choice or matrix questions) I couldn't use the qid from the sub-question, but needed to use the qid of the parent question and the "title" of the sub-question.
Thank you a lot. This resolved my issue!

So in my case to retrieve the timings for a group I needed the following parameters survey id and group id. I need to put them together in a code like this:
[sid]X[gid]time -> 758878X3478time

If I want to retrieve the answers i.E. a text answer or a single choice question (both are questions without child questions) I need the parameters survey id, group id, question id. I need to to put them together like this:
[sid]X[gid]X[qid] -> 758878X3477X42341

If I want to retrieve the answers for something like a multiple choice or matrix question (questions with child questions). I need the parameters survey id, group id, parent question id, child question title. I need to put them together like this:
[sid]X[gid]X[parent qid][child title] -> 758878X3477X42342SQ003

Again thanks a lot for your help, I was really blocked here.

Please Log in to join the conversation.

  • BBSR-SR5
  • BBSR-SR5's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
15 hours 1 minute ago #271343 by BBSR-SR5
Replied by BBSR-SR5 on topic Limesurvey API download Group timings
In case someone is googling this in the future. You can get the IDs for all fields with the API method"get_fieldmap()":  api.limesurvey.org/classes/remotecontrol...#method_get_fieldmap

I'Ve pulled an example from the survey I'm working on.

If you exported via the GUI this would be the column/variable: "SA02[x]"
Code:
"326961X223X1637x": {
            "fieldname": "326961X223X1637x",
            "type": "F",
            "sid": 326961,
            "gid": 223,
            "qid": 1637,
            "aid": "x",
            "sqid": 1807,
            "title": "SA02",
            "question": "<p>Was \u00fcberwiegt: Herausforderungen oder Chancen?</p>\r\n",
            "subquestion": "",
            "group_name": "[VI-SA02] Aktuelle Stimmung und Ausblick",
            "mandatory": "N",
            "encrypted": "N",
            "hasconditions": "N",
            "usedinconditions": "N",
            "questionSeq": 48,
            "groupSeq": 37,
            "preg": null,
            "SQrelevance": "1",
            "relevance": "1",
            "grelevance": "",
            "other": "N",
            "help": ""
      },

"title" is the "Code" you know from the GUI when creating a new question. "aid" is the "Code" from subquestions:
 

I may be feeling like an idiot right now, because I build something like this fieldmap from exporting single questions and merging them together to get all the relevant data.

Anyway, maybe this will save some future API users a lot of time.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
12 hours 47 minutes ago - 12 hours 45 minutes ago #271344 by Joffm
Replied by Joffm on topic Limesurvey API download Group timings
Hi,
thanks for sharing.

But in my opinion there are more direct ways.
You can list the SGQ code of your question with such equations (with the properties "gid" and "qid")
[url] www.limesurvey.org/manual/ExpressionScri...#Access_to_variables [/url]
 
E.g. in a text display


But these values you also see directly here
 

Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 12 hours 45 minutes ago by Joffm.

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose