- Posts: 32
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Displaying Monthly Summarized Responses for a Multiple-Choice Question
- doesthiswork
- Topic Author
- Offline
- Junior Member
Less
More
4 months 1 week ago - 4 months 1 week ago #253460
by doesthiswork
Displaying Monthly Summarized Responses for a Multiple-Choice Question was created by doesthiswork
Please help us help you and fill where relevant:
Your LimeSurvey version: Version 3.28.47
Own server
==================
Hi,
I am currently trying to figure out how to display the sum of responses to a multiple-choice question beneath the question itself.
The multiple-choice question asks for one of the following responses: daily, weekly, or monthly.
I would like to use a text display under the question to show how many times each option has been selected.
As a bonus feature, I'm interested in showing only the stats for the current month. Therefore, it might be useful to limit the summation to responses from the current month only.
Does anyone have any suggestions on how to achieve this?
Your LimeSurvey version: Version 3.28.47
Own server
==================
Hi,
I am currently trying to figure out how to display the sum of responses to a multiple-choice question beneath the question itself.
The multiple-choice question asks for one of the following responses: daily, weekly, or monthly.
I would like to use a text display under the question to show how many times each option has been selected.
As a bonus feature, I'm interested in showing only the stats for the current month. Therefore, it might be useful to limit the summation to responses from the current month only.
Does anyone have any suggestions on how to achieve this?
Last edit: 4 months 1 week ago by doesthiswork.
Please Log in to join the conversation.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12941
- Thank you received: 3979
4 months 1 week ago #253461
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Displaying Monthly Summarized Responses for a Multiple-Choice Question
Hi,
in your version you can use the plugin "getStatInSurvey"
[url] gitlab.com/SondagesPro/ExportAndStats/getStatInSurvey [/url]
This gives you the oppotunity to count the frequencies of your three options.
: shows the number of answer A1 to question Qcode
To get a monthly display I should say, you combine the actual month with the given answer in an equation (like "01_1",... "06_2", "10_3" and count these.
Just an idea. If I have time I will try.
Joffm
BTW:
Since version 5.x. there is a core plugin "statFunctions".
in your version you can use the plugin "getStatInSurvey"
[url] gitlab.com/SondagesPro/ExportAndStats/getStatInSurvey [/url]
This gives you the oppotunity to count the frequencies of your three options.
Code:
[Qcode.nb.A1]
To get a monthly display I should say, you combine the actual month with the given answer in an equation (like "01_1",... "06_2", "10_3" and count these.
Just an idea. If I have time I will try.
Joffm
BTW:
Since version 5.x. there is a core plugin "statFunctions".
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12941
- Thank you received: 3979
4 months 1 week ago #253465
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Displaying Monthly Summarized Responses for a Multiple-Choice Question
Hi,
just to confirm:
My mentioned idea works.
In an equation (eqQ1) after your question (Q1) enter
{join(date('m'),Q1)}
"date('m') returns the two digit number of the month (01...12)
And where you want to display the result, enter a nested IF like
for the answer option with code "1"
{if(date('n')==1,'[eqQ1.nb.011]',if(date('n')==2,'[eqQ1.nb.021]',if(date('n')=,'[eqQ1.nb.031]',if(date('n')==4,'[eqQ1.nb.041]',if(date('n')==5,'[eqQ1.nb.051]',if(date('n')==6,'[eqQ1.nb.061]',if(date('n')==7,'[eqQ1.nb.071]',if(date('n')==8,'[eqQ1.nb.081]',if(date('n')==9,'[eqQ1.nb.091]',if(date('n')==10,'[eqQ1.nb.101]',if(date('n')==11,'[eqQ1.nb.111]',if(date('n')==12,'[eqQ1.nb.121]',''))))))))))))}
"date('n')" returns the number of the month (1...12)
You see "011", "021", "031", ... is the joined two digit month number and the answer option code.
what we did in the equation "eqQ1"
And I added it to the answer option directly and added the total number with [Q1.nb.1]
And to display the month name ? "date('F')"
See
[url] www.php.net/manual/en/datetime.format.php [/url]
Rough example without a better styling
Joffm
just to confirm:
My mentioned idea works.
In an equation (eqQ1) after your question (Q1) enter
{join(date('m'),Q1)}
"date('m') returns the two digit number of the month (01...12)
And where you want to display the result, enter a nested IF like
for the answer option with code "1"
{if(date('n')==1,'[eqQ1.nb.011]',if(date('n')==2,'[eqQ1.nb.021]',if(date('n')=,'[eqQ1.nb.031]',if(date('n')==4,'[eqQ1.nb.041]',if(date('n')==5,'[eqQ1.nb.051]',if(date('n')==6,'[eqQ1.nb.061]',if(date('n')==7,'[eqQ1.nb.071]',if(date('n')==8,'[eqQ1.nb.081]',if(date('n')==9,'[eqQ1.nb.091]',if(date('n')==10,'[eqQ1.nb.101]',if(date('n')==11,'[eqQ1.nb.111]',if(date('n')==12,'[eqQ1.nb.121]',''))))))))))))}
"date('n')" returns the number of the month (1...12)
You see "011", "021", "031", ... is the joined two digit month number and the answer option code.
what we did in the equation "eqQ1"
And I added it to the answer option directly and added the total number with [Q1.nb.1]
And to display the month name ? "date('F')"
See
[url] www.php.net/manual/en/datetime.format.php [/url]
Rough example without a better styling
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- doesthiswork
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 32
- Thank you received: 0
4 months 1 week ago #253499
by doesthiswork
I will spin up a limesurvey 6.x instance and copy the current state of the survey over and try your suggestion!
Thanks so much!
Replied by doesthiswork on topic Displaying Monthly Summarized Responses for a Multiple-Choice Question
Thank you so much for your help! I was going to update my current instance to 6.x, since 3.x has been discontinued in june. There are still updates but who knows for how long. The plugin will also be availble in 6.x, right?Hi,
in your version you can use the plugin "getStatInSurvey"
[url] gitlab.com/SondagesPro/ExportAndStats/getStatInSurvey [/url]
This gives you the oppotunity to count the frequencies of your three options.
: shows the number of answer A1 to question QcodeCode:[Qcode.nb.A1]
To get a monthly display I should say, you combine the actual month with the given answer in an equation (like "01_1",... "06_2", "10_3" and count these.
Just an idea. If I have time I will try.
Joffm
BTW:
Since version 5.x. there is a core plugin "statFunctions".
I will spin up a limesurvey 6.x instance and copy the current state of the survey over and try your suggestion!
Thanks so much!
Please Log in to join the conversation.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12941
- Thank you received: 3979
4 months 1 week ago - 4 months 1 week ago #253503
by Joffm
Since version 5.x. there is a core plugin "statFunctions" which you can use.
Using this you avoid the nested IF with only
{statCountIf(eqQ1.sgqa, join(date('m'),1))}
with "1" as the code of the first answer option.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Displaying Monthly Summarized Responses for a Multiple-Choice Question
As I wrote:The plugin will also be availble in 6.x, right?
Since version 5.x. there is a core plugin "statFunctions" which you can use.
Using this you avoid the nested IF with only
{statCountIf(eqQ1.sgqa, join(date('m'),1))}
with "1" as the code of the first answer option.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 4 months 1 week ago by Joffm.
The following user(s) said Thank You: tpartner
Please Log in to join the conversation.
- doesthiswork
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 32
- Thank you received: 0
4 months 1 week ago #253630
by doesthiswork
Only thing I had trouble first, was activating the StatFunctions plugin. I had to press Scan files to install it. Wasn't metioned anywhere on the manual.limesurvey.org/StatFunctions page.
Replied by doesthiswork on topic Displaying Monthly Summarized Responses for a Multiple-Choice Question
Spun up a limesurvey 6.x instance and tested it out with my current survey. Worked like a charm. Thank you so much.
As I wrote:The plugin will also be availble in 6.x, right?
Since version 5.x. there is a core plugin "statFunctions" which you can use.
Using this you avoid the nested IF with only
{statCountIf(eqQ1.sgqa, join(date('m'),1))}
with "1" as the code of the first answer option.
Joffm
Only thing I had trouble first, was activating the StatFunctions plugin. I had to press Scan files to install it. Wasn't metioned anywhere on the manual.limesurvey.org/StatFunctions page.
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
4 months 1 week ago #253644
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Displaying Monthly Summarized Responses for a Multiple-Choice Question
The manual is a wiki. You should be able to add it.Only thing I had trouble first, was activating the StatFunctions plugin. I had to press Scan files to install it. Wasn't metioned anywhere on the manual.limesurvey.org/StatFunctions page.
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
Please Log in to join the conversation.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13648
- Thank you received: 2491
4 months 1 week ago #253667
by DenisChenu
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.
Replied by DenisChenu on topic Displaying Monthly Summarized Responses for a Multiple-Choice Question
I think need an update of
manual.limesurvey.org/Plugin_manager#General
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.
Please Log in to join the conversation.