PennController for IBEX › Forums › Support › getting variable from csv, based on a text in a column
- This topic has 1 reply, 2 voices, and was last updated 6 months, 2 weeks ago by Jeremy.
November 9, 2022 at 3:21 pm #9704ajessenParticipant
after a day of going through the forum, and trying a few things out, I give up and have to ask you:
I want to color certain elements of my texts (which are presented in a triangle canvas) based on a code in a column of my .csv list. I have no idea how to do this. I guess it should work with test.is, but I am really having a hard time translating what has been suggested here in some threads to my script. I appreciate any help!
Here’s my csv list:
NR,CODE,TOP,LEFT,RIGHT,Condition,Coloring_Code,group,PositionList,Position_Total 1,C,student,trimite,carte,F,OOR,L1,1,1 13,B,student,aduce,carte,F,OOO,L1,2,2 1,B,elevi,prindebine,pauză,DN,OLO,L1,3,3 1,A,fată,plăcea,înghețată,DN,OOO,L1,4,4 25,A,agent,lăuda,client,F,TOO,L1,5,5
and here my script:
Template("draft_list_2.csv", row => newTrial("experimental-trial", newText("top", row.TOP), newText("left", row.LEFT), newText("right", row.RIGHT), newCanvas("trialCanvas", 200,200) .settings.add( 50,0, getText("top")) .settings.add(-30,140, getText("left")) .settings.add(140,140, getText("right")) .center() .print(), newTextInput("response", "") .center() .log() .print() .wait());
Now, based on the column “Coloring_code”, I want to either have the “top” (TOO), the “left” (OLO), or the “right” (OOR) text element printed in blue, and no coloring with OOO.
I am sorry, I’m not very experienced with coding. Which is why I feel a little embarrassed, and was hesitant to ask publicly.
Could you help me? It is greatly appreciated!
I also have a question about Setcounter: I have 12 different lists (named group in my csv), who should be counterbalanced between participants. But starting the next list only after one participant has finished the previous is a bit late. I would like it to present the next list when Participant x is done with the practice trials and clicks on “continue to experiment”. I found this code here:
SetCounter("counter", "inc", 1);
and set in in the Sequence after “practice” and before “experiment” – but it did not seem to work. I still get list 2 (L2) presented, since I finished a trial run once.
thank you for any suggestion!
AnnaNovember 10, 2022 at 12:07 pm #9705JeremyKeymaster
I know we’ve already addressed these points by email, but I’ll post answers here too in case someone finds this post and wants answers
newText("top", row.TOP).color(row.Coloring_code=="TOO" ? "blue" : "black"), newText("left", row.LEFT).color(row.Coloring_code=="OLO" ? "blue" : "black"), newText("right", row.RIGHT).color(row.Coloring_code=="OOR" ? "blue" : "black"),
SetCounter("counter", "inc", 1);in your experiment will increase the counter earlier than by default, but the new value concerns the next participant: the current run will keep the same counter value that was assigned when the page was open. However, nothing guarantees that the next participant will indeed complete the experiment, and so you still risk ending up with unbalanced group assignments in your results. At the end of the day, there’s no way to *automatically* ensure you’ll have a balanced distribution, which is why the recommended method is to recruit participants using the server.py?withsquare=N method described int the tutorial, so you can easily manually control group assignment
- You must be logged in to reply to this topic.