Sum of 4 answers as condition to proceed


Author
Message
dokemm
dokemm
New Member (33 reputation)New Member (33 reputation)New Member (33 reputation)New Member (33 reputation)New Member (33 reputation)New Member (33 reputation)New Member (33 reputation)New Member (33 reputation)New Member (33 reputation)
Group: Forum Members
Posts: 3, Visits: 15
Hi everyone,
I am struggling with the following challenge.
I have a survey page with four single textbox-questions where I ask participants to evaluate how much percent of their attention in the trial before was directed to four different categories. So, e.g., 20% to the task before, 70% to something else...
I would like to check that participants can only proceed to the next survey page if the total amount of their shares of thoughts equals 100%. If it doesent, there shall be a warning message and particpiants need to adjust there answerts. My problem is, that I do not know how to implement this check. I need to add all the answers and check, whether the sum of the four answers = 100 percent. If so, the next surverypage should follow, if not participants would be encouraged to adapt their choice of values.
I tried something like the following, but do not know how to proceed:

/ontrialend = [if ((textbox.Seiteabbruch.response) + (textbox.komplettanderegedanken.response)+
(textbox.NBackGedanken.response)+ (textbox.NBackPerformanceGedanken.response)) == 100]

I would be very happy about any help.
This is the code.

<textbox ApartmentGedanken>
/ caption = "... der Wohnungsaufgabe von davor? (in Prozent)"
/ multiline = false
/ required = true
/ maxchars = 3
/textboxsize = (3.5%,2.5%)
</textbox>

slider ApartmentGedanken>
/ caption = "... die Apartment-Aufgabe von davor nachgedacht?"
/ subcaption = "        "
/ labels = ("0%","10%", "20%", "30%", "40%", "50%","60%", "70%", "80&", "90%","100 %")
/ range = (1%, 100%)
/ slidersize = (50%, 5%)
/required = false
/ showtooltips = false
/ increment = 1
</slider>

<textbox KomplettAndereGedanken>
/ caption = "... etwas ganz anderem? (in Prozent)"
/ multiline = false
/ required = true
/ maxchars = 3
/textboxsize = (3.5%,2.5%)
</textbox>


<textbox NBackGedanken>
/ caption = "... der 3-Zurück-Aufgabe? (in Prozent)"
/ multiline = false
/ required = true
/ maxchars = 3
/textboxsize = (3.5%,2.5%)
</textbox>


<surveypage Gedanken>
/caption ="XYZ."
/ subcaption = "XYZ."
/questions = [1 = ApartmentGedanken, KomplettAndereGedanken, NBackGedanken, NBackPerformanceGedanken]
/showpagenumbers = false
/showquestionnumbers = false
/ errormessage = true(text.error, 3000)
??????
</surveypage>


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 100K
dokemm - 8/10/2023
Hi everyone,
I am struggling with the following challenge.
I have a survey page with four single textbox-questions where I ask participants to evaluate how much percent of their attention in the trial before was directed to four different categories. So, e.g., 20% to the task before, 70% to something else...
I would like to check that participants can only proceed to the next survey page if the total amount of their shares of thoughts equals 100%. If it doesent, there shall be a warning message and particpiants need to adjust there answerts. My problem is, that I do not know how to implement this check. I need to add all the answers and check, whether the sum of the four answers = 100 percent. If so, the next surverypage should follow, if not participants would be encouraged to adapt their choice of values.
I tried something like the following, but do not know how to proceed:

/ontrialend = [if ((textbox.Seiteabbruch.response) + (textbox.komplettanderegedanken.response)+
(textbox.NBackGedanken.response)+ (textbox.NBackPerformanceGedanken.response)) == 100]

I would be very happy about any help.
This is the code.

<textbox ApartmentGedanken>
/ caption = "... der Wohnungsaufgabe von davor? (in Prozent)"
/ multiline = false
/ required = true
/ maxchars = 3
/textboxsize = (3.5%,2.5%)
</textbox>

slider ApartmentGedanken>
/ caption = "... die Apartment-Aufgabe von davor nachgedacht?"
/ subcaption = "        "
/ labels = ("0%","10%", "20%", "30%", "40%", "50%","60%", "70%", "80&", "90%","100 %")
/ range = (1%, 100%)
/ slidersize = (50%, 5%)
/required = false
/ showtooltips = false
/ increment = 1
</slider>

<textbox KomplettAndereGedanken>
/ caption = "... etwas ganz anderem? (in Prozent)"
/ multiline = false
/ required = true
/ maxchars = 3
/textboxsize = (3.5%,2.5%)
</textbox>


<textbox NBackGedanken>
/ caption = "... der 3-Zurück-Aufgabe? (in Prozent)"
/ multiline = false
/ required = true
/ maxchars = 3
/textboxsize = (3.5%,2.5%)
</textbox>


<surveypage Gedanken>
/caption ="XYZ."
/ subcaption = "XYZ."
/questions = [1 = ApartmentGedanken, KomplettAndereGedanken, NBackGedanken, NBackPerformanceGedanken]
/showpagenumbers = false
/showquestionnumbers = false
/ errormessage = true(text.error, 3000)
??????
</surveypage>


<textbox ApartmentGedanken>
/ caption = "... der Wohnungsaufgabe von davor? (in Prozent)"
/ defaultresponse = values.resp1
/ multiline = false
/ required = true
/ maxchars = 3
/textboxsize = (3.5%,2.5%)
</textbox>

<textbox KomplettAndereGedanken>
/ caption = "... etwas ganz anderem? (in Prozent)"
/ defaultresponse = values.resp2
/ multiline = false
/ required = true
/ maxchars = 3
/textboxsize = (3.5%,2.5%)
</textbox>


<textbox NBackGedanken>
/ caption = "... der 3-Zurück-Aufgabe? (in Prozent)"
/ defaultresponse = values.resp3
/ multiline = false
/ required = true
/ maxchars = 3
/textboxsize = (3.5%,2.5%)
</textbox>

<textbox NBackPerformanceGedanken>
/ caption = "... der 3-Zurück-Aufgabe? (in Prozent)"
/ defaultresponse = values.resp4
/ multiline = false
/ required = true
/ maxchars = 3
/textboxsize = (3.5%,2.5%)
</textbox>


<surveypage Gedanken>
/caption ="XYZ."
/ subcaption = "XYZ."
/questions = [1 = ApartmentGedanken, KomplettAndereGedanken, NBackGedanken, NBackPerformanceGedanken]
/showpagenumbers = false
/showquestionnumbers = false
/ ontrialend = [
    values.resp1 = textbox.ApartmentGedanken.response;
    values.resp2 = textbox.KomplettAndereGedanken.response;
    values.resp3 = textbox.NBackGedanken.response;
    values.resp4 = textbox.NBackPerformanceGedanken.response;
]
/ branch = [
    if (values.resp1 + values.resp2 + values.resp3 + values.resp4 != 100){
        surveypage.tryagain;
    };
]
</surveypage>

<values>
/ resp1 = ""
/ resp2 = ""
/ resp3 = ""
/ resp4 = ""
</values>

<surveypage tryagain>
/ caption = "The values need to add up to 100. Please try again."
/ showpagenumbers = false
/ branch = [
    surveypage.Gedanken;
]
</surveypage>

<surveypage end>
/ caption = "That's it."
/ showpagenumbers = false
</surveypage>


<block exampleblock>
/ trials = [1=surveypage.Gedanken; 2=surveypage.end]
</block>

dokemm
dokemm
New Member (33 reputation)New Member (33 reputation)New Member (33 reputation)New Member (33 reputation)New Member (33 reputation)New Member (33 reputation)New Member (33 reputation)New Member (33 reputation)New Member (33 reputation)
Group: Forum Members
Posts: 3, Visits: 15
Dave - 8/10/2023
dokemm - 8/10/2023
Hi everyone,
I am struggling with the following challenge.
I have a survey page with four single textbox-questions where I ask participants to evaluate how much percent of their attention in the trial before was directed to four different categories. So, e.g., 20% to the task before, 70% to something else...
I would like to check that participants can only proceed to the next survey page if the total amount of their shares of thoughts equals 100%. If it doesent, there shall be a warning message and particpiants need to adjust there answerts. My problem is, that I do not know how to implement this check. I need to add all the answers and check, whether the sum of the four answers = 100 percent. If so, the next surverypage should follow, if not participants would be encouraged to adapt their choice of values.
I tried something like the following, but do not know how to proceed:

/ontrialend = [if ((textbox.Seiteabbruch.response) + (textbox.komplettanderegedanken.response)+
(textbox.NBackGedanken.response)+ (textbox.NBackPerformanceGedanken.response)) == 100]

I would be very happy about any help.
This is the code.

<textbox ApartmentGedanken>
/ caption = "... der Wohnungsaufgabe von davor? (in Prozent)"
/ multiline = false
/ required = true
/ maxchars = 3
/textboxsize = (3.5%,2.5%)
</textbox>

slider ApartmentGedanken>
/ caption = "... die Apartment-Aufgabe von davor nachgedacht?"
/ subcaption = "        "
/ labels = ("0%","10%", "20%", "30%", "40%", "50%","60%", "70%", "80&", "90%","100 %")
/ range = (1%, 100%)
/ slidersize = (50%, 5%)
/required = false
/ showtooltips = false
/ increment = 1
</slider>

<textbox KomplettAndereGedanken>
/ caption = "... etwas ganz anderem? (in Prozent)"
/ multiline = false
/ required = true
/ maxchars = 3
/textboxsize = (3.5%,2.5%)
</textbox>


<textbox NBackGedanken>
/ caption = "... der 3-Zurück-Aufgabe? (in Prozent)"
/ multiline = false
/ required = true
/ maxchars = 3
/textboxsize = (3.5%,2.5%)
</textbox>


<surveypage Gedanken>
/caption ="XYZ."
/ subcaption = "XYZ."
/questions = [1 = ApartmentGedanken, KomplettAndereGedanken, NBackGedanken, NBackPerformanceGedanken]
/showpagenumbers = false
/showquestionnumbers = false
/ errormessage = true(text.error, 3000)
??????
</surveypage>


<textbox ApartmentGedanken>
/ caption = "... der Wohnungsaufgabe von davor? (in Prozent)"
/ defaultresponse = values.resp1
/ multiline = false
/ required = true
/ maxchars = 3
/textboxsize = (3.5%,2.5%)
</textbox>

<textbox KomplettAndereGedanken>
/ caption = "... etwas ganz anderem? (in Prozent)"
/ defaultresponse = values.resp2
/ multiline = false
/ required = true
/ maxchars = 3
/textboxsize = (3.5%,2.5%)
</textbox>


<textbox NBackGedanken>
/ caption = "... der 3-Zurück-Aufgabe? (in Prozent)"
/ defaultresponse = values.resp3
/ multiline = false
/ required = true
/ maxchars = 3
/textboxsize = (3.5%,2.5%)
</textbox>

<textbox NBackPerformanceGedanken>
/ caption = "... der 3-Zurück-Aufgabe? (in Prozent)"
/ defaultresponse = values.resp4
/ multiline = false
/ required = true
/ maxchars = 3
/textboxsize = (3.5%,2.5%)
</textbox>


<surveypage Gedanken>
/caption ="XYZ."
/ subcaption = "XYZ."
/questions = [1 = ApartmentGedanken, KomplettAndereGedanken, NBackGedanken, NBackPerformanceGedanken]
/showpagenumbers = false
/showquestionnumbers = false
/ ontrialend = [
    values.resp1 = textbox.ApartmentGedanken.response;
    values.resp2 = textbox.KomplettAndereGedanken.response;
    values.resp3 = textbox.NBackGedanken.response;
    values.resp4 = textbox.NBackPerformanceGedanken.response;
]
/ branch = [
    if (values.resp1 + values.resp2 + values.resp3 + values.resp4 != 100){
        surveypage.tryagain;
    };
]
</surveypage>

<values>
/ resp1 = ""
/ resp2 = ""
/ resp3 = ""
/ resp4 = ""
</values>

<surveypage tryagain>
/ caption = "The values need to add up to 100. Please try again."
/ showpagenumbers = false
/ branch = [
    surveypage.Gedanken;
]
</surveypage>

<surveypage end>
/ caption = "That's it."
/ showpagenumbers = false
</surveypage>


<block exampleblock>
/ trials = [1=surveypage.Gedanken; 2=surveypage.end]
</block>

Hallo Dave, I am so thankful. It works now. I did not know about the step to transfer the response to the values. Now it all makes sense. Thank you very much.


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search