View Issue Details

IDProjectCategoryView StatusLast Update
07641Feature requestsRemoteControlpublic2013-03-12 15:04
Reporteralibert Assigned To 
PrioritynormalSeverityfeature 
Status acknowledgedResolutionopen 
Summary07641: RemoteControl2 - export_responses - Tweak ResponseType to support all features like in frontend
DescriptionWith export_responses it is only possible to set the repsonse type to 'short' or 'long'.
However in the frontend it is possible to convert answercodes from 'Y' or 'N' to another character (in out case "1" and "2).

This should be supported in the remote control API-function export_responses.
Additional InformationPossible solution in export_responses (remotecontrol.php):

public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null, $sCompletionStatus='all', $sHeadingType='full', $sResponseType='short', $iFromResponseID=null, $iToResponseID=null, $aFields=null)
    {
....
        $oFomattingOptions->headingFormat=$sHeadingType;

        // Check if $sResponseType is an array
        // if yes set the formatting Options like this.
        if (is_array($sResponseType)) {
          $oFomattingOptions->answerFormat=$sResponseType['answerFormat'];
          $oFomattingOptions->convertY=$sResponseType['convertY'];
          $oFomattingOptions->yValue=$sResponseType['yValue'];
          $oFomattingOptions->convertN=$sResponseType['convertN'];
          $oFomattingOptions->nValue=$sResponseType['nValue'];
        }
        // if not, continue with the old behavior
        else {
          $oFomattingOptions->answerFormat=$sResponseType;
        }


        $oFomattingOptions->output='file';
....
        return base64_encode($sFileData);
    }

Call to the function would look like this:
$aFormat = array();
 $aFormat['answerFormat']='short';
 $aFormat['convertY']=true;
 $aFormat['yValue']='1';
 $aFormat['convertN']=true;
 $aFormat['nValue']='2';

this->export_responses( $sessionKey, $survey_id,'csv','de','all','code',$aFormat);

or shorter:

export_responses( $sessionKey, $survey_id,'csv','de','all','code',array('answerFormat'=>'short', 'convertY'=>true, 'yValue'=>'1', 'convertN'=>true, 'nValue'=>'2'));
TagsNo tags attached.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2013-03-06 15:30 alibert New Issue
2013-03-12 14:31 c_schmitz Status new => acknowledged
2013-03-12 14:31 c_schmitz Severity @40@ => feature