Welcome to the LimeSurvey Community Forum

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

API: export_responses_by_token - how to add token attributes

  • mfiora
  • mfiora's Avatar Topic Author
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
5 years 8 months ago #171608 by mfiora
Hello,
i'm using API to export to PDF all the completed responses.
I would like to add token attributes in the beginning of each response.

As you know if i specify the token attributes $aFields i only get the ones specified.
On the other hand i don't know how to get the whole list of "question identifiers" to rebuild the response (just like if $aFields is null).

Could you please help me in one way or the other? Is there a workaround?

Thanks,

Regards,
The topic has been locked.
  • mfiora
  • mfiora's Avatar Topic Author
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
5 years 8 months ago - 5 years 8 months ago #171657 by mfiora
Hello,
i found a workaround. I just modified the export_responses_by_token function adding a $bFields variable in input.
$bFields is an array containing the token attributes fields names. Then i just merged the 2 arrays just after
Code:
if (is_null($aFields)) $aFields=array_keys(createFieldMap($iSurveyID,'full',true,false,$sLanguageCode));
$aFields = array_merge($bFields,$aFields);


Thanks,

Regards,
Last edit: 5 years 8 months ago by mfiora.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose