Hi everyone.
I'm trying to make the ID variable sequencial. It has 3 digit and identifies the household. The data entry will be on android.
The problem is this option is deativated on field properties window.
Thanks
Sequencial ID number
Re: Sequencial ID number
ID items cannot be sequential in CSPro however there are some workarounds. This a question that has been discussed before on the forum. Here a some answers:
http://www.csprousers.org/forum/viewtop ... 277&p=3775
http://www.csprousers.org/forum/viewtop ... 920&p=2386
Searching for "sequential" in the forum will bring up more.
http://www.csprousers.org/forum/viewtop ... 277&p=3775
http://www.csprousers.org/forum/viewtop ... 920&p=2386
Searching for "sequential" in the forum will bring up more.
Re: Sequencial ID number
Thanks Josh,
I used this solution with some modifications:
I used this solution with some modifications:
Gregory Martin wrote:You can make your ID field both protected and persistent, and then write code like this:
PROC ID
preproc
if demode() = add then
if visualvalue(ID) = notappl then // this is the first case in the data file
ID = 1;
else // this is the second, third, etc. case in the data file
ID = visualvalue(ID) + 1;
endif;
endif;