Sequencial ID number

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
rcovane
Posts: 26
Joined: August 18th, 2015, 6:45 am

Sequencial ID number

Post by rcovane »

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
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Sequencial ID number

Post by josh »

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.
rcovane
Posts: 26
Joined: August 18th, 2015, 6:45 am

Re: Sequencial ID number

Post by rcovane »

Thanks Josh,

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;
Post Reply