Reply To: getting variable from csv, based on a text in a column

PennController for IBEX Forums Support getting variable from csv, based on a text in a column Reply To: getting variable from csv, based on a text in a column

#9705
Jeremy
Keymaster

Hi Anna,

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

1. It’s actually better to reserve Var elements for values that will only get set upon runtime. Column values are all preset (since they come directly from a pre-existing table) so using the javascript ternary conditional operator is to be preferred:

    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"),

2. Including 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

Jeremy