Forum Discussion

KarenKaren's avatar
KarenKaren
Qrew Trainee
12 years ago

Auto Numbering unique inventory items by department?

As we enter new items into our inventory database we would like it to automatically increase the inventory by 1.
We have several departments and each number should increment based on the department number
Expample

10-000111 would be one department
20-000234 would be a second department

The format has been used for many years and it would be difficult to change it. Also, we must start with the most current number for each department.

22 Replies

  • Have a look at this app.
    https://yqc.quickbase.com/db/bigy8ejyu
    I gave you Admin access. If you like you can contact me via my profile and I will transfer a copy to you.

    Basically the idea is to create a [Sequence #] field which is based on a formula which will start off the numbering by Department at whatever number you want to start at.

    var number StartNumber = Case([Department Number],"10",1234,"20",2000);
    Max($StartNumber,[Sequence # snapshot])
    Then we make a field called [Sequence # plus 1] which is the formula of [Sequence #] +1, and make a summary of the Maximum that field.

    and then do a lookup back down to the Antiques Table and then take a snapshot of that field called [Sequence # snapshot]

    By doing a snapshot we ensure that the numbers don't all get jiggled down when a record is deleted.

    The actual Serial # we display is this formula.

    [Department Number] & "-" & Right("00000" & ToText([Sequence #]),6)
    • DavidKnight's avatar
      DavidKnight
      Qrew Trainee
      I took this one step further. The case statement can be cumbersome to manage. As new codes are brought in, a user must remember to update the case statement. I simply added field to the Department Table [Starting Number] and changed [Sequence #] to:

      var number StartNumber = [Department - Starting Number];
      Max($StartNumber,[Sequence # snapshot])

      By making that field required, and annotating in description, users will remember to put a starting number in for new codes directly in the Department table.
    • DavidKnight's avatar
      DavidKnight
      Qrew Trainee
      I got it to work. Posting a picture of the relationships and fields should anyone else run into this
  • Thank you for the KISS answer but sadly we would like to keep the numbers sequential within each department.  I was looking at lookup but not sure how to set it up.  Can you provide an example?
  • Let me give you the stupid simple answer first, since if its acceptable, then there is not a reason to hurt your head with complexity.  Its where David Hawe was leading to ....

    A great unique number wheel is the [Record ID# field].  Look at you current number across all your various departments and find the highest number.   let say that is 1,500.

    So you could then use excel to import say 2,000 dummy records (or maybe 1,980 if you have already been testing and used up some [record ID#] numbers).

    Then we will make a formula field such as

    ToText([dept number]) & "-' & right("00000" & ToText([Record ID#]),6)

    so that formula will generate the dept number, then an dash and then the record ID# zero padded on the left to be always 6 characters.

    The sequence numbers will skip numbers when the Bronze takes say record id 2000 and then a furniture item is created and it will take the next sequence # 2001

    So the numbers would look like
    10-002000
    20-002001
    20-002002
    10-002003
    20-002004

    If that is good enough not to actually be sequential within each department code, then that is your KISS solution.
    If not, there are more complicated solutions using summary fields, snapshots and lookups.  But stupid simple always has its merits.
  • There is no reason it has to be only one up initially.  The idea would be that after we start auto numbering it would be sequential
  • Karen:  Can there be a gap in the sequence?  Example:  If 20-000123 is the the last Bronze, is the next required to be 20-000124 or can it be 20-000135 or anything as long as not less than the greatest so far?
  • We sell items including antiques.  Each piece is unique and needs to have a unique inventory number. Also depending on the category
    i.e furniture (10), bronze (20), lighting (30) etc. the inventory number would look like
    10-000111 for furniture
    20-000123 for Bronze
     Since we already have numbers assigned we cannot start at 1 we have to start with the next number in the specific category.
    This numbering system has been used for many years and is tied to our accounting system.

    I am not sure if I have clarified this or not.
  • When you say that you want to increase the inventory by 1, do you mean that you are assigning serial numbers to the pieces of inventory and want to increase a serial number wheel by 1 each time?  There is probably a way to do this if that is what you are after.