Make ID item sequential
Make ID item sequential
How can I make an ID item sequential (this item is not persistent).
-
- Posts: 1796
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Make ID item sequential
There are two ways you can do this. Using logic, you can keep track of the previously-entered ID and then increment it and assign it to the current ID field. The problem with this solution is that the ID item will only be sequential within a given run of CSEntry. If you close CSEntry and open it again, then the previously-entered ID will no longer be in memory. You can code this as follows:
See attached for a sample application.
PROC GLOBAL
numeric prevID = notappl;
PROC ID
preproc
if prevID <> notappl then
ID = prevID + 1;
noinput;
endif;
postproc
prevID = ID;
The other way to do this, which will keep track of the previous ID across CSEntry runs, it to declare your field as persistent and then override that setting using logic. For example, to set the starting ID as 1 and then go up from there, you would write:numeric prevID = notappl;
PROC ID
preproc
if prevID <> notappl then
ID = prevID + 1;
noinput;
endif;
postproc
prevID = ID;
PROC GLOBAL
PROC SEQID_QUEST
preproc
if visualvalue(ID) = notappl then
ID = 1;
else
ID = visualvalue(ID) + 1;
endif;
PROC ID
preproc
noinput;
PROC SEQID_QUEST
preproc
if visualvalue(ID) = notappl then
ID = 1;
else
ID = visualvalue(ID) + 1;
endif;
PROC ID
preproc
noinput;
See attached for a sample application.
- Attachments
-
- seqID.zip
- (2.08 KiB) Downloaded 587 times