Post by yiannis on Sept 30, 2020 20:47:00 GMT
Hi,
Apologies if this was asked before - I am afraid I cannot find the answer in the website or this board.
I have a radio-type question and the nature of the question is such that the answer chosen must add to a total sum.
For instance, consider the question "How many hours per day are you awake and how many hours asleep?". It only makes sense that the answers chosen to add up to 24 hours.
I do not know if PsyToolkit offers such functionality as a builtin feature, but I cannot find it myself and instead I used variables.
Please see script below.
The logic is that if the responses do not add up to 24.0 then return to question (OK, I also added a couple of questions for testing/debuging)
The issue is that I cannot reset the variables if the answers do not add to 24 meaning that any subsequent answers will add to the existing values of the variables.
Can someone point me to the right direction?
Thank you in advance,
P.S. Is there a way to change the "item" heading to something else in radio-type question - see here photos.app.goo.gl/JZo1f5q27D958qMv6
Apologies if this was asked before - I am afraid I cannot find the answer in the website or this board.
I have a radio-type question and the nature of the question is such that the answer chosen must add to a total sum.
For instance, consider the question "How many hours per day are you awake and how many hours asleep?". It only makes sense that the answers chosen to add up to 24 hours.
I do not know if PsyToolkit offers such functionality as a builtin feature, but I cannot find it myself and instead I used variables.
Please see script below.
The logic is that if the responses do not add up to 24.0 then return to question (OK, I also added a couple of questions for testing/debuging)
The issue is that I cannot reset the variables if the answers do not add to 24 meaning that any subsequent answers will add to the existing values of the variables.
Can someone point me to the right direction?
Thank you in advance,
P.S. Is there a way to change the "item" heading to something else in radio-type question - see here photos.app.goo.gl/JZo1f5q27D958qMv6
scale: ordered
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
l: hours_of_sleep
q: This is a question about hours of sleep/awake
t: scale ordered
o: free
- asleep
- awake
l: check_hours
t: set
- sum $hours_of_sleep
l: infosum
t: info
q: total hours {$check_hours} and the hours of sleep {$hours_of_sleep}
j: if $check_hours != 24.0 then goto hours_of_sleep
# if I land at next question then success
l: testing_success
q: Testing Success
t: info