Remote Control 2 - Export_responses

More
2 years 2 months ago #126467 by billionairez
billionairez created the topic: Remote Control 2 - Export_responses
Hey , guy
how can i use function --> Export_responses for export result of survey and add attribute in token too same export from LS web

Attachments:

Please Log in to join the conversation.

More
2 years 2 months ago #126495 by first
first replied the topic: Remote Control 2 - Export_responses
Just use standard windows selection technique (eg press control and keep selecting) to include token fields in export then you click Export data button. Note that token are at rightmost columns in the export

Survey Designer and Programmer

Please Log in to join the conversation.

More
2 years 2 months ago #126497 by billionairez
billionairez replied the topic: Remote Control 2 - Export_responses
i mean Remote Control 2 API and use function export_responses
how can i use option from function for get a token fields
/**
    * RPC Routine to export responses.
    * Returns the requested file as base64 encoded string
    *
    * @access public
    * @param string $sSessionKey Auth credentials
    * @param int $iSurveyID Id of the Survey
    * @param string $sDocumentType pdf,csv,xls,doc,json
    * @param string $sLanguageCode The language to be used
    * @param string $sCompletionStatus Optional 'complete','incomplete' or 'all' - defaults to 'all'
    * @param string $sHeadingType 'code','full' or 'abbreviated' Optional defaults to 'code'
    * @param string $sResponseType 'short' or 'long' Optional defaults to 'short'
    * @param integer $iFromResponseID Optional
    * @param integer $iToResponseID Optional
    * @param array $aFields Optional Selected fields
    * @return array|string On success: Requested file as base 64-encoded string. On failure array with error information
    * */
    public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null, $sCompletionStatus='all', $sHeadingType='code', $sResponseType='short', $iFromResponseID=null, $iToResponseID=null, $aFields=null)

Please Log in to join the conversation.

More
2 years 2 months ago #126504 by DenisChenu
DenisChenu replied the topic: Remote Control 2 - Export_responses
Hi,

Actually : you must:
- Find the token using api.limesurvey.org/classes/remotecontrol...od_list_participants
- Find the response using api.limesurvey.org/classes/remotecontrol...t_responses_by_token

You can improve Remote Control (think the best is to have a plugin event actually).

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
1 week 3 days ago #161223 by researchguru
researchguru replied the topic: Remote Control 2 - Export_responses
Hi guys,


We're trying to write a code for exporting responses as CSV format, by using API.

Please see the code which we created below:

<?php

/* * * * * * * * * * * * * * * * * * * * * *
* Start Edit
* * * * * * * * * * * * * * * * * * * * * */
define( 'LS_BASEURL', ' example.com ' ); // if subbfolder => http://localhost/MyFolder
define( 'LS_USER', '***' );
define( 'LS_PASSWORD', '***’);

$iSurveyId = 170925; // survey ID

/* * * * * * * * * * * * * * * * * * * * * *
* End Edit
* * * * * * * * * * * * * * * * * * * * * */
/* using LimeSurvey (LS) RemoteControly API version 2's JSON-RPC method */
include "application/libraries/jsonRPCClient.php";

/* instantiate a new client */
$lsJSONRPCClient = new jsonRPCClient( LS_BASEURL.'/index.php/admin/remotecontrol' );

/* receive session key */
$sessionKey = $lsJSONRPCClient->export_responses(LS_USER, LS_PASSWORD);

//export answers
$responses = $lsJSONRPCClient->call('export_responses', array( $sessionKey, 'csv', 'all', 'code', 'long'));
header('Content-Disposition: attachment;filename="answers_data.csv"');
header('Content-Type: application/force-download');
print_r(base64_decode($responses), null);

/* release the session key */
$lsJSONRPCClient->release_session_key($sessionKey);

?>

We get this error:
[01-Dec-2017 14:26:02 Etc/GMT] PHP Warning: base64_decode() expects parameter 1 to be string, array given in /home/resea2ig/public_html/lime/youla/ex.php on line 32
[01-Dec-2017 14:26:02 Etc/GMT] PHP Stack trace:
[01-Dec-2017 14:26:02 Etc/GMT] PHP 1. {main}() /home/resea2ig/public_html/lime/youla/ex.php:0
[01-Dec-2017 14:26:02 Etc/GMT] PHP 2. base64_decode() /home/resea2ig/public_html/lime/youla/ex.php:32

When I open downloaded file, it says “Array( [status] => Invalid session key)”

I'm just wondering if you anyone managed to create a code or can help us to solve the issue.

Many thanks
Mehdi
Attachments:

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!