Welcome to the LimeSurvey Community Forum

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

Query the hosted LimeSurvey sql database

  • Jjamison0221
  • Jjamison0221's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 11 months ago - 4 years 11 months ago #184176 by Jjamison0221
Query the hosted LimeSurvey sql database was created by Jjamison0221
I purchased the Hosted Enterprise Professional Package and would like to query the database using php. Would love help in finding out how to connect. My support tickets and phone calls to my initial contact have been ignored for the last 30 days.

Connecting to a hosted database to query seems like a fairly easy piece of info...maybe the good people on this forum know the answer?

Thanks.
Last edit: 4 years 11 months ago by Jjamison0221.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 11 months ago #184177 by holch
Replied by holch on topic Query the hosted LimeSurvey sql database
Have a look at the Limesurvey API.

However, I you should insist on a return on your phone calls and tickets, if you have the Hosted Enterprise Professional Package.

Here in the forum most of us have nothing to do with Limesurey GmbH and are volunteers giving support for the open source application. We have no insights on the SaaS service provided by the Limesurvey GmbH.

Send them an email. Maybe that helps.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • Jjamison0221
  • Jjamison0221's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 11 months ago #184179 by Jjamison0221
Replied by Jjamison0221 on topic Query the hosted LimeSurvey sql database
Thank you

At least you offered something in response. I'll dig into API and see if I can find a solution. I didn't want to bother the forum (knowing that everyone here is doing it out of the kindness) - but I'm desperate in a way and thought I might get lucky.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 11 months ago #184181 by holch
Replied by holch on topic Query the hosted LimeSurvey sql database
Well, 30 days with no response to a support ticket and not answering calls is not acceptable in my opinion. I don't know how they usually work, but I don't think that this is a normal response time for them.

So maybe you need to check if you are not doing something wrong.

I am also not aware of a support telephone. I think support works purely via ticket. But usually they respond these tickets in a timely manner.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 11 months ago #184182 by tpartner
Replied by tpartner on topic Query the hosted LimeSurvey sql database
@Jjamison0221, what are you trying to do? As holch suggests, it may be possible through the API instead of direct SQL queries.

My guess is that Limesurey GmbH will not let you access the database directly.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Jjamison0221
  • Jjamison0221's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 11 months ago #184183 by Jjamison0221
Replied by Jjamison0221 on topic Query the hosted LimeSurvey sql database
Thanks holch.

I wish it was just a ticket submission issue. But I did just today get a note from my 'handler' and he said he doesn't feel well and will let me know when he feels better and can help.

So no timeline and no solution. The support@limesurvey.org just keeps passing me to him and no one else is jumping in to help.

Don't like complaining, just seems like a simple solution. All I'm trying to do is report out the participation rate on the survey. I have been doing this with ASP-Net, php and javascript since the 90's. I just need access to where the data is being written. - thanks for being an anonymous sounding board. I'll grip no more.

Cheers.
The topic has been locked.
  • Jjamison0221
  • Jjamison0221's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 11 months ago #184184 by Jjamison0221
Replied by Jjamison0221 on topic Query the hosted LimeSurvey sql database
Tony,

I want to be able to report participation rate by an attribute on the survey. Say for example 10 of 100 males (10%). My attributes are coming from SAML relay into the database, I have the denominator to feed to the equation. I just need access to the data to know in real-time how many have responded.

This is just such a super simple thing to do in every survey I have ever created in any lanugage or on any server or database. I'm just at a loss for words that this isn't part of LimeSurvey already and secondly, that I've paid over $3,000 for a hosted solution and no one will give me the time of day.

I really liked the kid I was working with during initial installation, but now he has gone dark on me.

Not your problem.. but thanks for giving me hope by responding. Not sure I'll get access to the API unless someone at LimeSurvey GmbH responds to my requests.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 11 months ago #184186 by tpartner
Replied by tpartner on topic Query the hosted LimeSurvey sql database
You already have access to the API. All you need are admin credentials.

Here is a link to a post describing how to use the API in PHP to get a response by token (I couldn't find any examples of the export_responses() method but it will be similar) - www.limesurvey.org/forum/development/118...urvey-rpc-api#182796

A couple more links...

- manual.limesurvey.org/RemoteControl_2_API

- api.limesurvey.org/classes/remotecontrol...hod_export_responses

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Jjamison0221
  • Jjamison0221's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 11 months ago #184188 by Jjamison0221
Replied by Jjamison0221 on topic Query the hosted LimeSurvey sql database
Thanks Tony,

I'll follow that informative path you set before me. I hope you mean by admin credentials my LimeSurvey Login info - because that will mean I don't have to wait for anyone to get back with me. I'll use what you gave me and see where I get.
The topic has been locked.
  • christianlangkamp
  • christianlangkamp's Avatar
  • Offline
  • Junior Member
  • Junior Member
More
4 years 2 months ago #193998 by christianlangkamp
Replied by christianlangkamp on topic Query the hosted LimeSurvey sql database
Did this work in the end ?

I am looking also at a simple way how to maybe extract the data without always going through the exporter.

Ideally I would love to connect the list up to a KNIME instance, being able to just update my analysis dataset and then update the analysis workflow.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 2 months ago #194005 by Joffm
Replied by Joffm on topic Query the hosted LimeSurvey sql database
Hi,
here is an API script to get the entire survey data.
Code:
<?php
 
require_once 'jsonrpcphp/JsonRPCClient.php';
 
define( 'LS_BASEURL', 'https://www.example.com/survey');  // adjust this one to your actual LimeSurvey URL
define( 'LS_USER', 'myUserName' );
define( 'LS_PASSWORD', 'myPassword' );
 
// the survey to process
$survey_id=mySurvey_ID;
 
// instantiate a new client
$myJSONRPCClient = new \org\jsonrpcphp\JsonRPCClient( LS_BASEURL.'/index.php/admin/remotecontrol' );
 
// receive session key
$sessionKey= $myJSONRPCClient->get_session_key( LS_USER, LS_PASSWORD );
 
if(is_array($sessionKey))
{
    header("Content-type: application/json");
    echo json_encode($sessionKey);
    die();
}
 
/* Get the responses */
$response = $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
    'short', // answer : short|long , default : long
    2,  // First exported SAVEDID   or NULL
    3  // Last exported SAVEDID   or NULL
    ); 
 
$decodedString = base64_decode($response);
$aResponses = json_decode($decodedString, True);
 
// Find the first response ID
$aFirstResponse = reset($aResponses['responses'][0]);
 
echo '<table style="border-collapse: collapse; text-align: left;">';
echo '<tr>';
// Insert column headers
foreach($aFirstResponse as $key => $value) {
  echo '<th style="border: 1px solid #CCC; padding: 2px 7px;">'.$key .'</th>';
}
echo '</tr>';
 
foreach($aResponses['responses'] as $key => $row) {
//echo "Key: ".$key."  Row: ".$row;
  echo '<tr>';
  // Insert the data
  foreach(reset($row) as $key => $item) {
     echo '<td style="border: 1px solid #CCC; padding: 2px 7px;">'.$item .'</td>';
  }
  echo '</tr>';
        }
echo '</table>';
 
 
 
// release the session key
$myJSONRPCClient->release_session_key( $sessionKey );
 
 
?>

See here:
api.limesurvey.org/classes/remotecontrol...hod_export_responses




Joffm


Or you do it with direct access in php.
It is not to difficult to include a mapping table (SGQA-Codes -> question text)

And it's always better to open a new thread than to continue such an old one.
I am really sure Jjamison0221 is looking into the forum and will not be able to answer your question.

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
More
4 years 2 months ago #194014 by jelo
Replied by jelo on topic Query the hosted LimeSurvey sql database

Joffm wrote: Or you do it with direct access in php.

The thread is about how to access LimeSurvey instances hosted by LimeSurvey GmbH.
Direct access via PHP would be a big surprise in that context.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose