log, overwriting, form base
Dear Sebastian,
First of all, thank you very much for this wonderful and lifesaving programme. It’s really a must for anyone who is doing experiments in psychology.
I used the tutorials and forum a lot and I’ve been able to find all I needed so far. However, now I have a problem that’s been giving me headaches for days. I’ve read all forum posts about it but I just cannot find the solution, or it could be that I don’t understand what you’ve been proposing.
I won’t bother you with all experiment, just the problematic part. I want to give my participants a test with proposed answers and they should pick one out. In the loop I have following variables: question, responseA … responseE, q_number. After that I have a form base which I coded like this:
widget 1 1 8 2 label center=yes text="[question]"
widget 0 4 1 1 checkbox group=group1 text=a var=answer
widget 0 5 1 1 checkbox group=group1 text=b var=answer
widget 0 6 1 1 checkbox group=group1 text=c var=answer
widget 0 7 1 1 checkbox group=group1 text=d var=answer
widget 0 8 1 1 checkbox group=group1 text=e var=answer
widget 1 4 5 1 label center=no text="[repA]"
widget 1 5 5 1 label center=no text="[repB]"
widget 1 6 5 1 label center=no text="[repC]"
widget 1 7 5 1 label center=no text="[repD]"
widget 1 8 5 1 label center=no text="[repE]"
widget 5 9 1 1 button center=yes text=ok
After that I have a logger. However, when I run the experiment, what I get is only the last response. I understand it is because of my code since it rewrites it every time. I’ve tried adding several incline scripts like: if var.Q_number == 1
answer1 = 'answer'
But it didn’t work. I tried resetting the counter (but I wasn’t sure which variable I should reset). I tried using self.experiment.set("answer1", self.get("answer")) that you proposed in one of the posts, but it didn’t work. So could you please tell me what am I doing wrong and what incline script I should write in order to get in my log the answer for each question.
Thank you in advance for saving my experiment and life.
Comments
Hi,
I'm not sure whether I understand your structure. Maybe it would be better if you bothered us with a little more of your experiment .
Are the question all on the same form, or on separate forms that are executed in sequence? If they are separate then you only need add a logger in between each of the forms.
Eudard
Hi Eduard,
Thanks for your quick reply.
In short, all questions are in the same form.
Longer version :
Basically i just want to ask participants some multiple choice questions in a random order and to collect their choice for each question. (it sounds very simple, but i'm having really hard time figuring this out)
In the loop I have a variable "question", variables "response a", "response b", "response c" etc. and "Q_number" which is the question number.
After that I have a form in which I present questions (widget 1 1 8 2 label center=yes text="[question]") and their proposed answers (widget 0 4 1 1 checkbox group=group1 text=a var=answer). So practically all questions are on the same form.
Now I understand that as the program starts new question it reads the form code from the begining and it rewrites the variable answer (widget 0 4 1 1 checkbox group=group1 text=a var=answer).
So I think I need a line or an incline script where I would tell it to save the response for each question before it continues to the next one.
I know that it would be much easier to have a form for each question, but I'm not sure how to make them random then.
Thank you in advance for your help.
Hi,
In that case, how about not using
answer
for each question, but something unique?That is also quite doable, especially if you have the elements (questions and answer options) already coded in a loop. If every row of your loop table has a unique question. You can make a loop-sequence which iterates over the questions. Randomization shouldn't be a problem.
Eduard
Hmm I think it would be best to show how it looks (perhaps I didn't explain it that well):
These are the experiment and the form. When I try writing something like var="answer\_[Q_number]" it tells me that answer_1 is not a valid name. And I am not sure how to use different name for each question in the same forme_base.
The second thing you propose is precisely how I do it right now, but in one form. I cannot seem to add more than one form_base in one loop.
I know that this is something very basic and easy and I apologize for taking your time. I'm just stucked here.
Oh, now it is clear. Your
logger
is not correctly placed. It has to be inside the sequence, right after your form, not outside the sequence. This should fix it. No need for changing variables names, and that kinda stuff.Eduard
Dear Eduard,
Thank you so very much! I knew it was something very easy I was missing. Hahaha I cannot believe I missplaced it.
Once again, thank you very much and have a nice weekend.