|
-
Oct 14th, 2012, 04:54 PM
#1
Thread Starter
Hyperactive Member
Auto Calculating codes using specified algorithm.
Bit of a though request from boss, and did not want to say "Dunno how"
Each time a new product are added I must assign it a product code, which will be a 3 digit numerical code.
For the first 9 products it should be "010" to "090".
After that it should be "110" to "190", then "210" to "290", etc.
Anyone did sth like this. Bit late for me to think straight.
-
Oct 14th, 2012, 09:00 PM
#2
Re: Auto Calculating codes using specified algorithm.
So basically you just want a sequential code in multiples of 10, correct? If the data is being stored in a database then you could simply use an auto-generated ID as normal and then add an extra calculated field using an expression that multiplies the ID by 10. In SQL Server that would mean a ProductID column with (Is Identity) set to Yes and a ProductCode column with (Formula) set to 'ProductID * 10'.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|