Welcome to the LimeSurvey Community Forum

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

Show survey data total

  • flasher44
  • flasher44's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 6 months ago #174536 by flasher44
Replied by flasher44 on topic Show survey data total
I cannot get the syntax correct in order to reference the first sub-question of a list-item question with two subquestions answers.
surveyID = 162958
GroupID = 31
QuestionID = 309
Subquestion answer #1: Especes_1
Subquestion answer #2: Especes_2

Then I use this SQA value to identify my question : 162958X31X309Especes_1


But it does not work …


Any idea why ?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #174549 by tpartner
Replied by tpartner on topic Show survey data total
I don't understand what a "list-item" question is. If it's a list-radio it has answers, not sub-questions.

The identifier that you are looking for is the column name in the database. If you do not have access to the database, activate the survey and then export some responses using the "Question codes" option. You will see these column headers in the Excel file.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • flasher44
  • flasher44's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 6 months ago #174572 by flasher44
Replied by flasher44 on topic Show survey data total

tpartner wrote: I don't understand what a "list-item" question is.


I mean the question type with ID309 is : array (number)

And what I call "list item" of the sub question are number to choose between 0 to 20


It's not a radio button type at all, all answers are NUMBERS.

OK so I did you what you said, I exported the answers to excel, and in the column header was written as question code : Especes[1_1].


I tried the new SQA value 162958X31X309Especes[1_1] , but it does not work.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #174582 by DenisChenu
Replied by DenisChenu on topic Show survey data total
Screenshot of Question logic file

Else : manual : manual.limesurvey.org/Expression_Manager#Access_to_Variables

Something like QCODE_Especes_1 or QCODE_1_Especes

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.
  • flasher44
  • flasher44's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 6 months ago #174605 by flasher44
Replied by flasher44 on topic Show survey data total
none are working ...
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #174615 by DenisChenu
Replied by DenisChenu on topic Show survey data total
Send a screenshot of Question logic file …

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.
  • flasher44
  • flasher44's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 6 months ago #174617 by flasher44
Replied by flasher44 on topic Show survey data total
Here is a copy of the orginal survey with the same problem…


The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago - 5 years 6 months ago #174630 by tpartner
Replied by tpartner on topic Show survey data total
According to that logic file, the identifier for the first x-axis sub-question (first column) of Bird 1 would be 459729X34X336BI1_SQ001.

Bird 2 would be 459729X34X336BI2_SQ001.

...

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 5 years 6 months ago by tpartner.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago - 5 years 6 months ago #174639 by DenisChenu
Replied by DenisChenu on topic Show survey data total
Or
Code:
{SPECIES_BI2_SQ001.sgqa}
:) then it's OK when you copy the survey …

: SGQA in lowercase see manual.limesurvey.org/Expression_Manager#Access_to_Variables at end of table.

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.
Last edit: 5 years 6 months ago by DenisChenu.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #174641 by tpartner
Replied by tpartner on topic Show survey data total
Sure, but this is being done in a Twig file so probably:

Code:
processString('{SPECIES_BI2_SQ001.sgqa}')

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #174642 by DenisChenu
Replied by DenisChenu on topic Show survey data total

tpartner wrote: Sure, but this is being done in a Twig file so probably:

You're right …

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.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago - 5 years 6 months ago #174648 by tpartner
Replied by tpartner on topic Show survey data total
@flasher44, so, if following your screenshot of the logic file, my original code should be something like this:

Code:
<div> 
  {% set bird1SGQA = processString('{SPECIES_BI1_SQ001.sgqa}') %}
  {% set aResponses = getAllTokenAnswers(aSurveyInfo.sid) %}
  {% set responseSum = 0 %}
  {% set responseCount = 0 %}
  {% set responseToken = '' %}
 
  {% for response in aResponses %}
    {% if (response[bird1SGQA] != '') %}
      {% set responseSum = responseSum + response[bird1SGQA]|number_format %}
      {% set responseCount = responseCount + 1 %}
    {% endif %}
 
    {% if (loop.index == 1) %}
      {% set responseToken = response['token'] %}
    {% endif %}
  {% endfor %}
 
  {% if (responseCount > 0) %}
    There are {{ responseCount }} valid responses for Q1 with token value {{ responseToken }}.
    <br />
    The sum of all valid responses  is {{ responseSum }}.
    <br />
    The average of all valid responses is {{ (responseSum/responseCount) }}.
  {% endif %}
</div>

NOTE: all instances of sgqa should be in lower-case - see image below. (the forum is transforming the case in the code above)


Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 5 years 6 months ago by tpartner.
The following user(s) said Thank You: DenisChenu
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose