Saving Assessment scores to survey database

More
5 years 7 months ago #76621 by gsaha
gsaha replied the topic: Saving Assessment scores to survey database
Hi Sequioa,
For each group, you will need to create a number input question and make it not mandatory.
You will need to input the following code in that numerical input question. Change the numbers 55972 , 9 and 311 to match your survey number, group number and question number. Make sure you do not set the question to hide.

<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>

Please Log in to join the conversation.

More
5 years 7 months ago #76627 by TMSWhite
TMSWhite replied the topic: Saving Assessment scores to survey database
sequoia-

Although gsaha may be right for 1.91+, that approach is not needed for 1.92.

In fact, you almost had it. Instead of:
{sum(q1.NAOK,q2.NAOK,q3.NAOK,q4.NAOK)}

use
{sum(q1.value,q2.value,q3.value,q4.value)}

You could also use
{sum(q1.valueNAOK,q2.valueNAOK,q3.valueNAOK,q4.valueNAOK)}

but, since q1-q4 are always relevant, there is no need for the NAOK suffix

The .value suffix retrieves the assessment value for the answer. When you were using {sum(q1,q2,q3,q4)}, it was retrieving the answer id, so say you answered A1,B2,C3,D1, {sum{q1,q2,q3,q4)} would be 0, since the integer value of "A1" is 0, whereas {sum(q1.value,q2.value,q3.value,q4.value)} would be the equivalent of {sum(5,10,9,1)}, and returns the assessment value of 35.

Please Log in to join the conversation.

More
5 years 7 months ago #76633 by Ben_V
Ben_V replied the topic: Saving Assessment scores to survey database
Thanks Tom,

Could not be more clear !

Benoît

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)

Please Log in to join the conversation.

More
5 years 7 months ago - 5 years 7 months ago #76699 by sequoia
sequoia replied the topic: Saving Assessment scores to survey database
Thanks so much for the input gsaha, TMSWhite and benitov! TMSWhite's input with my 1.92+installation worked great as I'm now able to view assessment total in the db and in the email. :)

I do have two follow up inquries that may also be of interest to other newbies with LimeSurvey...
  • Concerning the assessment total function, it is placed in a question entry. I can have visibility turned off for this one question, but in doing so it removes that data from the email sent out (there is though a db entry and the assessment rules shows corresponding results). Is there a workaround for this? (that is, have the question with the 'Equation'/{sum} output listed in the distributed email but not visible in the survey). What I have now is a blank question page with a sum value in the question area.
  • I've read before in another part of the forum benitov's posts regarding the removal of the question codes in any result printout (completed survey page/email) and had no success. The '<span class="nocode">' worked the first time (with the corresponding CSS rule in 1.91+), there after I only had one question for the entire survey. After I removed the code bit things returned back to normal (thus hesitant to try again with the upgraded 1.92+ version). Is there a new functionality with 1.92+ that can remove these answer codes from view in any result print page?

(areas highlighted I'm looking to remove)

Thanks again as always from the newbie ;)
Last Edit: 5 years 7 months ago by sequoia.

Please Log in to join the conversation.

More
5 years 7 months ago #76714 by Ben_V
Ben_V replied the topic: Saving Assessment scores to survey database
1)

.... visibility turned off for this one question, but in doing so it removes that data


Maybe you can just emule the submit button putting the following code in the source of the question
The may problem is that you have to set your survey "question by question" or "group by group" with a group dedicated for this sole question because the effect will be to skip directly to the next step (next question, group or final submission)
<script type="text/javascript">
jQuery(document).ready(function($) {
 
// Adapt all survey, group & question ID s....
//!\\ document.getElementById('display123').style.display= "none";
//!\\ document.getElementById('answer789X456X123').style.display= "none";
 
document.limesurvey.submit();
 
});
</script>
 

2) for the class="nocode" I've no other solution... If you don't want to create a new css class, you can use inline css like
<span style="display:none"> <!-- don't close this tag -->

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)

Please Log in to join the conversation.

More
5 years 7 months ago #76757 by sequoia
sequoia replied the topic: Saving Assessment scores to survey database
Thank you Benitov for your assistance. The 'display:none' tag did the job. I did though have one answer with a strikethrough through the text in the results email. Not sure why, hopefully its a one time issue as I'll be doing some more testing.

Regarding the javascript in your previous post, is that for use in 1.91+, 1.92+, or both? (I currently have installed 1.92+) ; And would I need to supplement the specific data from my survey into the " ('display123') " (parenthesis) areas?

Again thanks for your input everyone.

Please Log in to join the conversation.

More
5 years 7 months ago #76758 by TMSWhite
TMSWhite replied the topic: Saving Assessment scores to survey database
FYI, elements like 'display123' no longer exist in 1.92.

Please Log in to join the conversation.

More
5 years 7 months ago #76759 by sequoia
sequoia replied the topic: Saving Assessment scores to survey database
Would you have any suggestions to the particular inquiry TMS White?

•Concerning the assessment total function, it is placed in a question entry. I can have visibility turned off for this one question, but in doing so it removes that data from the email sent out (there is though a db entry and the assessment rules shows corresponding results). Is there a workaround for this? (that is, have the question with the 'Equation'/{sum} output listed in the distributed email but not visible in the survey). What I have now is a blank question page with a sum value in the question area.

Or would Benitov's suggestion working with javascript be the best/current workaround?

Please Log in to join the conversation.

More
5 years 7 months ago #76760 by TMSWhite
TMSWhite replied the topic: Saving Assessment scores to survey database
sequioa-

If I'm understanding you, you want to email to contain the assessment score, but not have it show in the survey (or in the print your answers page).

If so, you can simply edit the template for the email being sent out. You can still have the hidden equation to compute the score (so it will be in the database, but never seen by the user). Then, in the email template, say "The subject's score was {score}"

Please Log in to join the conversation.

More
5 years 7 months ago #76762 by sequoia
sequoia replied the topic: Saving Assessment scores to survey database
TMSWhite-

Thank you for responding.

I'm seeking to have the assessment score output to all three areas (completed survey page, database, and email). This has been resolved with one 'side effect' so to speak...

To better clarify, the issue is with the survey containing a blank question page (the 'equation' question type) with the current assessment total in the question area (and nothing else).

Again I really appreciate all the input, and it helps us newbies get better acclimated to the LimeSurvey programming more rapidly for our needs.

Please Log in to join the conversation.

More
5 years 7 months ago #76763 by TMSWhite
TMSWhite replied the topic: Saving Assessment scores to survey database
can you attach a screenshot of what you mean by this?

the issue is with the survey containing a blank question page (the 'equation' question type) with the current assessment total in the question area (and nothing else).

Please Log in to join the conversation.

More
5 years 7 months ago #76892 by sequoia
sequoia replied the topic: Saving Assessment scores to survey database
Sure TMS, here you go:




Any 'Format' setting (i.e. group by group, question by question, etc.), same appearance.

Please Log in to join the conversation.

More
5 years 7 months ago #76895 by TMSWhite
TMSWhite replied the topic: Saving Assessment scores to survey database
sequoia-

To hide an equation, simply set the advanced question option "Always hide this question" to "Yes". The equation will still be computed (and the data saved), but the question will not appear. And, if it is the only question within a group, the group will not appear either.

Please Log in to join the conversation.

More
5 years 7 months ago #76900 by sequoia
sequoia replied the topic: Saving Assessment scores to survey database
Thank you again TMS for your correspondence.

I've noted before that when I've turned visibility off (by doing as you posted with the 'Always Hide This Question') that the survey works as it should, both in hiding the question page and showing the complete (end) page accordingly. The issue with doing this is there was no db entry, and the email did not include that assessment total data from the now hidden page in the {ANSWERTABLE} layout in the message delivered.

I've went back and changed back to 'Yes' for the 'Always Hide This Question' option. Happy to say now there is a database entry, but still no assessment total in the {ANSWERTABLE} part of the email. BUT, what I have done is put in the subject entry (i.e. 'Detailed admin notification subject') the reference code (i.e. '{overallTotal.value}') and the assessment total/data is carried over to the delivered email that way.

I'm not sure why there was no database entry before (could upgrading to 1.92+ have something to do with it? I last tested with 1.91+ with hiding the question and no db entry for the hidden question was made). And I'm content that although the hidden page output was not included in the {ANSWERTABLE} layout of the email, having it in the email subject works fine.

Again thanks TMS and others before who posted support in this inquiry of mine.

Please Log in to join the conversation.

More
5 years 7 months ago #76906 by sequoia
sequoia replied the topic: Saving Assessment scores to survey database
To add: By adding independently the assessment code (i.e. '{overallTotal.value}') into the email template body I can include the assessment total that way as well into the delivered email message.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now