Issue with selected_rows when using a custom variable in online experiment

I’m fairly confident that the issue here is that you are setting the selected rows as a string of comma-separated indices instead of a list.

Try putting $stimnum_sample in your loop. If you’ve already tried this and get the same error then perhaps there’s an issue with your create of stimnum_sample. Try printing it to the console.