Provide id automaticaly

Discussions about CSEntry
Post Reply
Fab
Posts: 6
Joined: October 29th, 2015, 9:13 am

Provide id automaticaly

Post by Fab »

Good morning. I am working now on a project were I use numeric tablette to collect data. I want to write a logic with permit to fill automatically the Id of manages, in order of their interview.
Please, some one can help me?
Anne
Posts: 104
Joined: January 11th, 2012, 12:55 am

Re: Provide id automaticaly

Post by Anne »

You want the ID to be sequential? (first interview = 1, second = 2 etc)? Then you'll have a problem when merging the data if there's more than one tablet.. You could solve this by predefining a range or something (first interview on first tablet = 101, second interview on first tablet = 102 etc)..

But do you need the ID at all? If not: I like to use a combination of systime() and tablet ID/Interviewer ID. This way I'm guaranteed the ID is unique, and you'll know the order of the interviews from the size of systime() (if you need that).

If you still want sequential ID, I'd use an external file to write what was the last ID used, and then add one to this number for the next interview.

Anne
Fab
Posts: 6
Joined: October 29th, 2015, 9:13 am

Re: Provide id automaticaly

Post by Fab »

Thanks very much Anne. I want sequential ID. But, I don't know how to use the external file as you suggest in the third option.
Can you help me to do it please?
Thanks.
Anne
Posts: 104
Joined: January 11th, 2012, 12:55 am

Re: Provide id automaticaly

Post by Anne »

It is actually quite complicated: You do not want to make a new ID if you're in modify mode, and you don't want to write the ID to the file if you're not sure that the keyer really saves the record etc..

I think I wouldn't do this if I were new to CSPro :)

But what I suggest to do inestead, is to use the ID i suggested, and then - after data entry it would be easy to add a variable that is sequential that you can use as an ID in a batch job..

Anne
Fab
Posts: 6
Joined: October 29th, 2015, 9:13 am

Re: Provide id automaticaly

Post by Fab »

Thanks Anne.
Post Reply