Benet Posted October 21, 2008 Posted October 21, 2008 i have a database that relates stock items to jobs. mostly the stock items are individual and have as specific "serial number" hence are individual records. In this case if a stock item is related to a job i simply fill in a jobID field in the stock item record and the relationship is made. However some stock items are multiple, like "10mm washers" for example. in this case i reduce the stock quantity to match how many have been used on a particular job. the problem comes when i go to write the relationship. As i only have one jobID field in the stock item record, when i go spread the washers across several jobs the jobID is overwritten and the relationship with all but the most recent job fails. Is there a way of using a repeating field or merge field in some way so that a stock record can be related to multiple jobs. Or, maybe i need to look at this another way ? I find myself wishing relationships had an "or" function as well as "and" Currently the relationship that binds stock to jobs is stock:jobID = jobs:JobID Thanks Ben
comment Posted October 21, 2008 Posted October 21, 2008 Relationships do have an AND function: if you write multiple JobID's, separated by a carriage return, into the foreign key field in StockItems, that item will be related to all of the listed jobs. However, this method is very limited, because you cannot assign individual quantities to specific jobs. The correct way is to create a join table with fields for JobID, ItemID and Quantity.
Benet Posted October 21, 2008 Author Posted October 21, 2008 Thanks, the carriage returns works perfect, im not sure how i got this far into the filemaker without it. However of course you a quite right i cant seperate out the quantity. Could you expand a little on "join table" would it only contain those fields ? ben
comment Posted October 21, 2008 Posted October 21, 2008 A join table (or 'associative entity') is the standard way to facilitate a many-to-many relationship in a relational database (not just in Filemaker). At minimum, a join table needs the two foreign keys to its "parent" tables - but it can have other fields to describe the attributes of a specific join, such as Quantity in your example. See a basic demo here: http://www.fmforums.com/forum/showpost.php?post/246136/
Recommended Posts
This topic is 6224 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now