Welcome to the LimeSurvey Community Forum

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

export_statistics gives "xxx" is not defined.

  • jared.kail
  • jared.kail's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 7 months ago #231900 by jared.kail
Please help us help you and fill where relevant:
Your LimeSurvey version: 5.3.32+220817
Own server or LimeSurvey hosting: Self
Survey theme/template: Default
==================
Hello,

All of my remote control calls up to and including get_summary have worked just fine. However, when I call export_statistics I get the following error:
Code:
Request error: "Property \"Response_397719.397719X176X763764\" is not defined."
I am calling it using the "xls" $docType, but using "pdf" does not matter. I have attached the .lss of the survey. I have stepped through a lot of code but deciphering someone else's data structures is always a challenge and I have been unable to determine if the problem is in my survey setup or a bug in LimeSurvey. 

Are there any LimeSurvey gurus out there that can give me a hand to figure out what's fouled up?

Thanks,

Jared



 

Please Log in to join the conversation.

  • jared.kail
  • jared.kail's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 7 months ago #231957 by jared.kail
Replied by jared.kail on topic export_statistics gives "xxx" is not defined.
More Info [this is not an answer]:

This appears to be a mismatch where the answers are using SGQA format of SIDXGIDXQID[sqid] where [sqid] is the subqestion id, while responses are using the format of SIDXGIDXQID[title], where [title] is the title of the question, e.g. SQ001.

On line 2305 of statistics_helper.php you see the following:
Code:
if ($oResponse->$sResponseColumn == 'Y') {

Here $oRespose is built using SIDXGIDXQID[title] attributes. $sResponseColumn ultimately is created at line 1186 in common_helper.php in createCompleteSGQA, and uses SIDXGIDXQID[sqid]. As a result, the response is not found and an error is generated.

Any ideas out there?

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 7 months ago #231959 by tpartner
Replied by tpartner on topic export_statistics gives "xxx" is not defined.
Hard for us to say without seeing your API call code.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • jared.kail
  • jared.kail's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 7 months ago - 1 year 7 months ago #231960 by jared.kail
Replied by jared.kail on topic export_statistics gives "xxx" is not defined.
Thanks for your reply! Here's the full API call:
Code:
public function getStatistics(): array {
$survey = $this->getSurvey();
if (empty($survey))
throw new Exception("No survey to get statistics for");
 
$result = $this->getClient()->export_statistics($this->getSessionKey(), $this->getSurveyId(), "xls");
if (isset($result["status"]))
throw new Exception("Error getting statistics data: " . $result["status"]);
 
return $result;
 
}
 
NOTE: $this->getSurvey() loads the survey I uploaded earlier as a .lss
Last edit: 1 year 7 months ago by jared.kail. Reason: Added additional info

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 7 months ago #231963 by tpartner
Replied by tpartner on topic export_statistics gives "xxx" is not defined.
I don't get it.

A PHP script using export_statistics() works fine with a survey containing list-radio questions but if an array question exists (like yours), I get this error:

Code:
Warning: Illegal string offset 'message' in C:\xampp\htdocs\limeSurvey5x\upload\themes\survey\api-calls\jsonRPCClient.php on line 175
 
Fatal error: Uncaught RuntimeException: Request have return error: P; Request: {"jsonrpc":"2.0","method":"export_statistics","params":["Q662unHBumcF1~a76Ul0iRQnTHbzy_m1",396972,"pdf","en","yes"],"id":2}; in C:\xampp\htdocs\limeSurvey5x\upload\themes\survey\api-calls\jsonRPCClient.php:251 Stack trace: #0 C:\xampp\htdocs\limeSurvey5x\upload\themes\survey\api-calls\jsonRPCClient.php(183): jsonRPCClient->validate(true, 'Request have re...') #1 C:\xampp\htdocs\limeSurvey5x\upload\themes\survey\api-calls\api_export_statistics_pdf.php(48): jsonRPCClient->__call('export_statisti...', Array) #2 {main} thrown in C:\xampp\htdocs\limeSurvey5x\upload\themes\survey\api-calls\jsonRPCClient.php on line 251

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • jared.kail
  • jared.kail's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 7 months ago #231969 by jared.kail
Replied by jared.kail on topic export_statistics gives "xxx" is not defined.
Agreed. I just spot-tested several other question types and they all came back OK. The only one that appears to generate the error is the "Multiple Short Text" question type. When I generated a new test survey with just that type I get the same error I indicated in my first report (Property \"[sgqa]" is not defined).

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 7 months ago #231983 by tpartner
Replied by tpartner on topic export_statistics gives "xxx" is not defined.
Please file a bug report - bugs.limesurvey.org .

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose