Welcome, Guest
Username: Password: Remember me

TOPIC: summing up answers to build conditions

summing up answers to build conditions 3 years 4 months ago #60234

  • Zappes
  • Zappes's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 20
  • Karma: 0
Hello!

I am quite new in using Limesurvey and I posted already a question in the german forum but did not get an answer so I post in the Englisch one with the hope to get answer.

I did an assesment with two questions question1: ("Over the last week how often have you been bothered by any of the following problems?") and 9 subquwestions.
Answeroptions are ( not at all (value 0)); several days (value 2)); more than the half (value 3)); nearly every day (value 4)).

question two is a condition to question 1 in in that way that i want to sum up the scores of the values of question 1 and build ranks (subquestion of question 2 only show when score of question 1 is bewteen 0-5; subquestion of question 2 only show when score of question 1 ist between 5-10 ;....)

Is that possible?
Thank you for your help!!!
The administrator has disabled public write access.

Aw: summing up answers to build conditions 3 years 4 months ago #60258

  • Zappes
  • Zappes's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 20
  • Karma: 0
OK I found a possible solution with following JavaScript. But it does not work.
Has anybody an idea?

<div style="text-align: left">These are your answers:<br />
============================
<p><script LANGUAGE="JavaScript">

var a = "gar nicht";
var b = "an einzelnen Tagen";
var c = "an mehr als die Hälfte der Tage";
var d = "beinahe jeden Tag";


if ("{INSERTANS:23621X29X124SQ001}" == isreallytrue )
{
if ("{INSERTANS:23621X29X124SQ001}"== a) {answer = 0;}
else if ("{INSERTANS:23621X29X124SQ001}"== b) {answer = 1;}
else if ("{INSERTANS:23621X29X124SQ001}"== c) {answer = 2;}
else if ("{INSERTANS:23621X29X124SQ001}"== d) {answer = 3;};
antwortitem1 = parseInt(answer);
totalsumme = antwortitem 1
}


if(totalsumme<2)
document.write( "Sie haben folgende Punktwerte erreicht kleiner zwei" = "totalsumme" );
else if(totalsumme>2)
document.write( "grösser 2 " = "totalsumme" );
}
</SCRIPT></p>
</div>



'THANK YOU!
The administrator has disabled public write access.

Aw: summing up answers to build conditions 3 years 4 months ago #60282

  • Zappes
  • Zappes's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 20
  • Karma: 0
found myself an answer:


<div style="text-align: left;">Hier ist Ihr Testergebnis:<br />
===================
<p><script LANGUAGE="JavaScript">
// Die mögliche Antworte

var a = "gar nicht";
var b = "an einzelnen Tagen";
var c = "an mehr als die Hälfte der Tage";
var d = "beinahe jeden Tag";

// Ergebniss von Antwort1 kriegen und in antwort1 speichern
var antwort1 = "{INSERTANS:23621X29X124SQ001}";
//document.write("Antwort1 ist " + antwort1);

// Je nach Antwort das Score setzen
var antwort1Score = 0;
if (antwort1 == a) {antwort1Score = 0;}
else if (antwort1 == b) {antwort1Score = 1;}
else if (antwort1 == c) {antwort1Score = 2;}
else if (antwort1 == d) {antwort1Score = 3;}

// Score checken
//document.write("Antwort1 Score ist " + antwort1Score);

// Das gleiche fuer Antwort 2
var antwort2 = "{INSERTANS:23621X29X126SQ001}";
//documentwrite("Antwort2 ist " + antwort2);

var antwort2Score = 0;
if (antwort2 == a) {antwort2Score = 0;}
else if (antwort2 == b) {antwort2Score = 1;}
else if (antwort2 == c) {antwort2Score = 2;}
else if (antwort2 == d) {antwort2Score = 3;}

//document.write("Antwort2 Score ist " + antwort2Score);

// Das gleiche fuer Antwort 3
var antwort3 = "{INSERTANS:23621X29X128SQ001}";
//document.write("Antwort3 ist " + antwort3);

var antwort3Score = 0;
if (antwort3 == a) {antwort3Score = 0;}
else if (antwort3 == b) {antwort3Score = 1;}
else if (antwort3 == c) {antwort3Score = 2;}
else if (antwort3 == d) {antwort3Score = 3;}

//document.write("Antwort3 Score ist " + antwort3Score);

var ant1 = parseInt(antwort1Score)
var ant2 = parseInt(antwort2Score)
var ant3 = parseInt(antwort3Score)


//document.write("PARSEINT " + ant1);

var summe = (ant1 + ant2 + ant3);

//document.write("summe " + summe);

if(summe <2)
document.write( "Sie haben folgende Punktwerte erreicht kleiner zwei: totalsumme ist " + summe

else if(summe>2)
document.write( "grösser 2: totalsumme ist " + summe);
</SCRIPT></p>
</div>
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.110 seconds
Donation Image