View Issue Details

IDProjectCategoryView StatusLast Update
12241Feature requestsImport/Exportpublic2017-03-31 00:54
Reporterbrammeleman Assigned To 
PrioritynoneSeverity@50@ 
Status newResolutionopen 
Summary12241: not possible to select all token-attributes in the export_responses_by_token api call
DescriptionIf the last argument of export_responses_by_token ($aFields) == null, all answers are added to the report. If you would like to get token attributes as well, you would need to feed it an array with all question codes AND all token + attribute fields.

Bests,

Bram
Additional InformationA possible solution would be replacing:

if (is_null($aFields)) $aFields=array_keys(createFieldMap($iSurveyID,'full',true,false,$sLanguageCode));

with

if (is_null($aFields)) {
    $questionFields=array_keys(createFieldMap($iSurveyID,'full',true,false,$sLanguageCode));
    $attributeFields = array_keys(getTokenFieldsAndNames($iSurveyID, TRUE));
    $aFields = array_merge($questionFields, $attributeFields);
}

in the function definition of export_responses_by_token (application/helpers/remotecontrol/remotecontrol_handle.php)
Since the export_responses function is nearly identical, this should also reflect this change.

Another solution could be an extra optional argument in the function call and roughly the same code:

function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode=null, $sCompletionStatus='all', $sHeadingType='code', $sResponseType='short', $iFromResponseID=null, $iToResponseID=null, $qFields = null, $aFields = null)

with something like:
if (is_null($aFields)) {
    $aFields=array_keys(createFieldMap($iSurveyID,'full',true,false,$sLanguageCode));
}
if (is_null($qFields)) {
  $qFields = array_keys(getTokenFieldsAndNames($iSurveyID, TRUE));
}
$fields = array_merge($aFields, $qFields);

(replacing all following $aFields bij $fields)
TagsNo tags attached.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2017-03-30 12:50 brammeleman New Issue
2017-03-31 00:54 DenisChenu Project Bug reports => Feature requests