Duplicate serial number

Discussions about editing and cleaning data
Forum rules
New release: CSPro 8.0
Post Reply
Tsheringcee
Posts: 12
Joined: July 4th, 2017, 4:21 am

Duplicate serial number

Post by Tsheringcee »

Is it poosible to put a check in a batch editing program to check for any duplicate serial number in a roster entered by the keyer during entry

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

Re: Duplicate serial number

Post by josh »

You could use the count function with "where" to get the number of rows in the roster with the same serial number as the serial number of the current row. Something like:
PROC SERIAL

if count(MYROSTER000 where SERIAL = SERIAL(curocc())) > 1 then
    
errmsg("Duplicate serial number");
endif;
Here serial(curocc()) is the serial number of the current row so the count() will return the number of rows whose serial matches the one that was just entered. If the result is greater than 1 then this is a duplicate.

Another option is to set the SEQUENTIAL property on the serial field and have CSEntry fill it in automatically. If you do this you can also make the field protected so that the user cannot change it. That way you can never duplicate serial numbers.
Tsheringcee
Posts: 12
Joined: July 4th, 2017, 4:21 am

Re: Duplicate serial number

Post by Tsheringcee »

Thank u so much
Post Reply