AnsweredAssumed Answered

Composite Key

Question asked by Svetlana on Jun 13, 2013
Latest reply on Jun 24, 2013 by philmodjunk


Composite Key


     Hello everyone,

     I need help putting together a script that generates a unique composite key. The composite key will be the "Item number" that the company uses to identify each item it created, and it is a necessary component of the Product DB the company already has- as each record in the DB is based on the Item Number. The Item Number has to be based on two fields that the user has to enter before it can be generated, followed by a number sequence that is unique to each combination of the two fields. It also gets a little more tricky, however.

     Here is an example of how an item number looks for the company: WDWA0001. (It is broken down into WD- WA- 0001).

     "WD" should be returned if the value is "Disney" in the field called License."WA" should be returned if the value is "Wallet" in the field called Product. The values for both fields are currently from seperate value lists.

     To make this script work, I was thinking of creating seperate tables- one called "License" and one called "Product," with two seperate fields for the name of the license/product ("Disney") and the abbreviation ("WD"). Is that a good idea?

     I hope that made sense. Please let me know if I can clarify anything or add more info to help. Any help or guidance would be much appreciated. I've spent quite some time pouring over forum posts and any blog posts I could find, but nothing that really helps me get a clear understanding of how to structure this or where to even begin.