- Posts: 5
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Remote Control 2 - Export_responses
- billionairez
- Topic Author
- Offline
- New Member
Less
More
8 years 5 months ago #126467
by billionairez
Remote Control 2 - Export_responses was created by billionairez
Attachments:
The topic has been locked.
- first
- Offline
- Elite Member
Less
More
- Posts: 256
- Thank you received: 37
8 years 5 months ago #126495
by first
Survey Designer and Programmer
Replied by first on 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
The topic has been locked.
- billionairez
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
8 years 5 months ago #126497
by billionairez
Replied by billionairez on 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
how can i use option from function for get a token fields
Code:
/** * 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)
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13907
- Thank you received: 2546
8 years 5 months ago #126504
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on 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
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 , plugin development .
I don't answer to private message.
The topic has been locked.
- researchguru
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
6 years 3 months ago #161223
by researchguru
Replied by researchguru on 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
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:
The topic has been locked.