Autogenerate ID

Discussions about CSEntry
Post Reply
tweg
Posts: 29
Joined: June 16th, 2015, 2:41 am

Autogenerate ID

Post by tweg »

I using the following code to auto-generate ID but it works for the first record and subsequently I get and error message for duplicate record.
preproc
if demode() = add then
if visualvalue($) = notappl then // this is the first case in the data file
$ = 1;
else // this is the second, third, etc. case in the data file
$ = visualvalue($) + 1;
endif;
endif;

Thanks
Regards
Thad
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Autogenerate ID

Post by josh »

Did you make the field persistent? If it isn't persistent then you will end up assigning the same value each time which will give you duplicate ids.
tweg
Posts: 29
Joined: June 16th, 2015, 2:41 am

Re: Autogenerate ID

Post by tweg »

Thanks it works now perfectly after setting the field as persistent.

Regards
Thad
Post Reply