1

I'm generating csv files based on the results of people answering a survey on 2 different machines. The files will be on a shared folder.

Right now, it will assign each new file with a subject number by looking up the demographic file and see how many people completed the survey. Unfortunately, if we have two people start the program at the same time, they'll end up having the same subject id number. How can I fix this issue?

durron597
  • 31,968
  • 17
  • 99
  • 158
Nguyễn Duy
  • 91
  • 1
  • 8

1 Answers1

2

What you are trying to do is come up with a system for locking down the ID numbers as soon as the program is run.

You should record the subject number in a separate location as soon as the survey begins (a database would be preferred, but a flatfile would work as well). It's important to ensure this mechanism is currency safe.

Further reading on this subject: Generating a globally unique identifier in Java

Community
  • 1
  • 1
durron597
  • 31,968
  • 17
  • 99
  • 158
  • The problem is that I can't have access to a database. So I'll try storing it in a file to see how that work. Thank you ! – Nguyễn Duy Apr 10 '15 at 20:21