Welcome to the LimeSurvey Community Forum

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

Saving Assessment scores to survey database

More
12 years 1 month ago #73726 by gsaha
I am on Version 1.91+ Build 12358

I have 20 survey questions. Each question is a radio list with 5 labels and each label has an assessment value.
I have no problem displaying the assessment data as Total assessment score to the user at the end of their survey.
However this data is not saved to the limesurvey database and hence no statistics can reported on this assessment data.

I have seen some examples of javascript, but not sure how to achieve saving assessment data to the limesurvey database for statistics reporting.
Any help would be so appreciated.
Attached is the format of each of my survey questions
thanks in advance
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
12 years 1 month ago #73749 by Mazi
Saving the assessment score to the database is not possible at version 1.91. You have to make use of one of the Javascript workarounds to store the total score in a hidden question which can then also be analysed using the internal statistics feature.

At version 1.92 you can use the expression manager to sum up all scores and store it at the database, see docs.limesurvey.org/Expression+Manager+H..._Assessment_Examples

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
More
12 years 1 month ago #73773 by gsaha
Thanks so much.
Could you point me to what kind of javascript I can create for a hidden question to calculate the sum of the assessments?
Thanks again so much
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
12 years 1 month ago #73814 by Mazi

gsaha wrote: Thanks so much.
Could you point me to what kind of javascript I can create for a hidden question to calculate the sum of the assessments?
Thanks again so much

There should be some examples at manual -> workarounds -> javascript and at the forums as well.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
More
12 years 1 month ago #73832 by Ben_V
HI,
1) Set your survey group by group or question by question
2) Set a numerical input type question (in a separate group in case of group by group navigation)
3) In the source of the question copy the following code and adapte the SurveyID_X_GroupID_X_QuestionID code
(look at the related attached image if you've got a problem)
Code:
<script type="text/javascript">
jQuery(document).ready(function() {
document.getElementById('answer89176X314X3005').value = "{ASSESSMENT_CURRENT_TOTAL}";
 
// Avoid possibility to change the assess value if the question is not hidden 
$('#answer89176X314X3005').attr( "readonly","readonly" );
});
</script>
 
// Emule SUBMIT or NEXT button action
<script type="text/javascript">
jQuery(document).ready(function($) {
document.limesurvey.submit();});
</script>


Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Attachments:
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
12 years 1 month ago #73833 by tpartner
Replied by tpartner on topic Saving Assessment scores to survey database
You can use the {ASSESSMENT_CURRENT_TOTAL} placeholder to access the assesssment total from previous pages.

The following will load a short-text input with the {ASSESSMENT_CURRENT_TOTAL} and hide it where:
11111 = survey ID
22 = group ID
33 = question ID
Code:
<script type="text/javascript" charset="utf-8">
 
  $(document).ready(function(){
 
    $('#answer11111X22X33').val('{ASSESSMENT_CURRENT_TOTAL}');  
    $('#question33').hide();
  });
 
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
12 years 1 month ago #73851 by gsaha
Thanks a million benitov and tpartner:) :) :) :)
I took both of your ideas and this works perfectly

<script>
jQuery(document).ready(function() {
document.getElementById('answer55972X9X311').value = "{ASSESSMENT_CURRENT_TOTAL}";
document.getElementById('display311').style.display= "none";
document.getElementById('answer55972X9X311').style.display= "none";
});
</script><script>
$(document).ready(function()
{
$('#question311').hide();
});
</script>


I set the survey question by question.
Also I set filter HTML for XSS to NO

Thanks again so much
The topic has been locked.
More
12 years 1 month ago #74068 by giankuka
Replied by giankuka on topic Saving Assessment scores to survey database
I have a equation question: if(CH1.valueNAOK, 0, sum(TA1.valueNAOK, TA2.valueNAOK) / 2); I set it as hidden. But I would like to have it in the results email and in the statistic. I tryed to use your script but It doesn't work,I'm not able :).
Someone can help me?
Thanks, Gianluca
The topic has been locked.
More
12 years 1 month ago #74069 by gsaha
Hi Giankuka,
I am not on 1.92
Still on 1.91
I used a numeric input question and made it hidden using the script below.
You will need to modify the numbers 55972x9x311 to your survey number, group number and question number.
Not sure about the result email.
But you will certainly get statistics like this:

Field summary for 0021:
Calculation Result
Count 30
Sum 463
Standard deviation 5.71
Average 15.43
Minimum 4
1st quartile (Q1) 12
2nd quartile (Median) 14.5
3rd quartile (Q3) 17.25
Maximum 30
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
12 years 1 month ago #74087 by Mazi
giankuka, the approaches for 1.91 and 1.92 work different. At 1.92 you can use the Expression Manager for this while at 1.91 you have to make use of the above workaround (which should also work for 1.92 when applied correctly.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
More
12 years 1 month ago #74129 by giankuka
Replied by giankuka on topic Saving Assessment scores to survey database
Ok now I solved the problem about the email; now i would like to have this "sum(TA1.valueNAOK, TA2.valueNAOK)/2" in the statistics. Is It possible?
The topic has been locked.
More
12 years 1 month ago #74131 by Ben_V
Hi,
Probably you just have to expand the advanced settings of your question and tick the checkbox:
'Show in public statistics'

Ben

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose