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
3 days 22 hours ago #271274 by BBSR-SR5
Limesurvey API download Group timings was created by BBSR-SR5
Please help us help you and fill where relevant:
Your LimeSurvey version:  LimeSurvey Cloud Version 6.15.5
Own server or LimeSurvey hosting: Cloud
Survey theme/template: Irrelevant
==================
Hello everyone, 
I'm trying to export group timings via the API function export_responses. I've seen this older thread , but unfortunately I don't quite understand how you move from the group ID (like "216") to a cryptic field name like "159677X490X12345time" in the expamle. I've been trying list_groups or even get_group_properties to see if it was hidden there somewhere, but didn't find anything.

I really need the group timings so I can see if a question was even accessed.

Thank you :)

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 days 21 hours ago #271276 by tpartner
Replied by tpartner on topic Limesurvey API download Group timings

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: BBSR-SR5

Please Log in to join the conversation.

  • BBSR-SR5
  • BBSR-SR5's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 days 20 hours ago #271277 by BBSR-SR5
Replied by BBSR-SR5 on topic Limesurvey API download Group timings
Thank you, that helps to explain it :)

I'm still a bit confused why this has a question number if I'm retrieving the group timings.

"159677X490X12345time"

Following the SGQA schema this should be survey "159677", group "490", question "12345" answer "time". Can I just take any question number from the group or does it need to be a specific one?

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 days 20 hours ago #271282 by holch
Replied by holch on topic Limesurvey API download Group timings
My bet is that there is no such thing as "group timing". The group timing is probably just the time of the last question in the group. But I am just guessing here. Let's wait and see what others have to say.

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 days 19 hours ago #271284 by tpartner
Replied by tpartner on topic Limesurvey API download Group timings
Export the some data and see what you have as column names. Those should be the identifiers used in the API call.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • BBSR-SR5
  • BBSR-SR5's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 day 27 minutes ago - 1 day 25 minutes ago #271330 by BBSR-SR5
Replied by BBSR-SR5 on topic Limesurvey API download Group timings

Export the some data and see what you have as column names. Those should be the identifiers used in the API call.
Hm, I tried that but it doesn't seem to work. If I export without setting fields, I'm getting something like this as a json:
Code:
"id": 11, "submitdate": null, "lastpage": 42, "startlanguage": "de", "seed": "786809226", "token": "txxxxx", "startdate": "2024-04-30 13:32:52", "datestamp": "2024-04-30 13:43:00", "SH01[x]": "10",

If I try by actually defining the fields I only get null values for the answers and the timings (the other fields still work):
Code:
"id": 11, "submitdate": null, "lastpage": 42, "startlanguage": "de", "seed": "786809226", "token": "txxxxx", "startdate": "2024-04-30 13:32:52", "datestamp": "2024-04-30 13:43:00", "SH01[x]": null, "326961X209X1790time": null,
 Any idea why this doesn't seem to work?
Last edit: 1 day 25 minutes ago by BBSR-SR5.

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 day 19 minutes ago #271331 by tpartner
Replied by tpartner on topic Limesurvey API download Group timings
Export the data to Excel via the GUI not via the API.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
23 hours 28 minutes ago - 22 hours 27 minutes ago #271333 by Joffm
Replied by Joffm on topic Limesurvey API download Group timings
Hi,
how is your survey displayed ("group by group" or "question by question")?
If you display group wise there are no question timings and viceversa.

But as long as you only show some small snippets of your code, it's difficult to answer.

So, please, create a small prototype, send the lss export and your script to export this.

Joffm

BTW:
You mentioned this
[url] forums.limesurvey.org/forum/can-i-do-thi...with-json-rpc#225030 [/url]
Maybe you got confused.
The shown script is not the script that produces the output in the screenshot.

The first - and most important - statement is:
You have to define all fields you want to export.

and an explanation of the - as you said before - cryptic codes
These time fields with SGQ-syntax.

And at the screenshot there is written
(only timing of groups) 

Just to show that you can do both (depending on the mode of display)

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

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
22 hours 30 minutes ago #271335 by Joffm
Replied by Joffm on topic Limesurvey API download Group timings
Hi,
I did a small test - with a small survey.
Displayed "group bey group"
And with this script
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','973111X3474X42337','973111X3474X42338','973111X3475X42339','interviewtime','973111X3474time','973111X3475time','973111X3476time']
);

I got this result
 

So, everything is fine.
Here the Excel Export to compare
 
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: BBSR-SR5

Please Log in to join the conversation.

  • BBSR-SR5
  • BBSR-SR5's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
22 hours 28 minutes ago - 22 hours 25 minutes ago #271336 by BBSR-SR5
Replied by BBSR-SR5 on topic Limesurvey API download Group timings
Empty post: Got forum errors when having too much code in my post.
Last edit: 22 hours 25 minutes ago by BBSR-SR5. Reason: information

Please Log in to join the conversation.

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

Export the data to Excel via the GUI not via the API.



 
That also results in fieldnames like SH01[x]. I've also tried the SPSS version (which would be SH01_x) but that also doesn't work.

how is your survey displayed ("group by group" ofr "question by question")?

Group by group. 

So, please, create a small prototype, send the lss export and your script to export this.


Okay I attached a small prototype .lss

I've put a small python script together. I haven't been trying to use any SGQA codes, just using the stuff from the gui excel export as tpartner suggested.

This results in only null values exported for the questions and timings:

For some reason the forum doesn't like my code and results so I put it in a zip...
 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
21 hours 6 minutes ago #271338 by Joffm
Replied by Joffm 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

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: BBSR-SR5

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose