Description of the problem: hello. I have a csv file in the resources folder in gitlab where I keep the number of participants that completed the experiment. I want to update that csv file in a way that gives me the new number of participants each time a participant completes the experiment. Either of the following would work for me if you have any suggestions how to do it:
1- Updating the content of the csv file: I can start the value from (say) 0 at the very beginning of the experiment (like, before any participant completes the task). After a participant completes the task, I can update the content with like 0+1 = 1, then for the second participant I can do 1+1 = 2. This would be a solution for me to count the number of participants (yet, I couldnāt figure out how to make it work in js).
2- Appending a new row of the existing csv file and counting the number of rows: I can start the first line with (say) 9999 for the 0th participant. I can append a new line to the csv file every time a participant complete the task. The total number of rows in the csv file would thus, give me the total number of participants (yet, I couldnāt figure out how to make this one work in js either).
Once I get the number of participants, I will use it to index and draw data from another csv file in the resources folder (for now, I am able to do it with some dummy numbers).
I know the solution but I cant implement in js Does anybody have any idea about how to either update the content of an existing csv file or append a new row in pavlovia/js?
any help would be much appreciated! thanks in advance, tutku
thank you for your reply. I think the link you inserted aims to assign random ID numbers to the participants. But what i need instead is the number of participants to be updated every time the experiment is completed so that I can index another csv file and draw the nth data and use it in the experiment. is it even possible to do that with the link that you sent?
In a MySQL database. Why donāt you give it a go and see how it works. If you click the link multiple times with the same experiment then the participant number will go up. However, it canāt be reset remotely, so you might want to test with a fake experiment name.
thank you wakecarter. I gave it a shot with a dummy experiment, it works quite well and I think I will use the link that you sent.
But i couldnt get how to reach the number of the last participant (although you said its being saved in a mysql database), probably because im not very familiar with these kinds of stuff. like, does it save the participant ids to an external file that i can reach with my psychojs code?
thank you so much again and sorry for bothering with too many questions
tutku
Unfortunately it canāt cope with participants who fail to complete. To do that Iād need to rewrite the tool such that participant numbers could be validated by returning to the tool at the end of the experiment and then participant numbers that donāt get validated within a few hours get recycledā¦
isnt it possible to assign like 9999 at first to a participant until he/she completes the experiment and at the end of the experiment, replace 9999 with the real incremented ID number? I cant say that im really familiar with javascript coding style - what it is capable and what it is not capable of - but if its possible to do such a thing, maybe that would be a solution.
but still, this is just enough to solve my problem as it is for now. Iāll have to take care of participants who do not complete the task myself which is fine, because they will be incrementing ānā unpurposely and thereby change the order of the data that i want to retrieve from another external csv file.
At the moment the number is assigned by counting rows. The number has to be assigned at the start so that it gets used in the experiment, and also needs to be able to cope with multiple participants overlapping (one starts before the previous one finishes).