Page 1 of 1

Autogenerate ID

Posted: September 5th, 2015, 8:59 am
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

Re: Autogenerate ID

Posted: September 7th, 2015, 8:22 am
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.

Re: Autogenerate ID

Posted: September 10th, 2015, 7:16 am
by tweg
Thanks it works now perfectly after setting the field as persistent.

Regards
Thad