Along the lines of, "what is an appropriate use of an object field", I've 
been considering this:

We are a manufacturing company with lots of tools and lots of products. 
Each tool has various attributes, but each tool type has a different set 
of characteristics. 

Silly example that I hope everyone can follow: if the tool type is 
"screwdriver" then the attributes might be:

Tip Type (blade, Phillips, Torx, etc.)
Tip Size (#1 or #2)
Shank length (in mm)
Handle diameter (in mm)


...If the tool type, however, is "hammer" then the attributes might be:

Head type (claw, peen, sledge, etc.)
Claw shape
Head weight
Shank material
Shank length
Grip Type
...and many more


Common to all tools, regardless of tool type are attributes such as:

Tool ID
Tool Type - which determines the format and contents of the object field 
that contains the attributes
Storage Location
Purchase Date
Condition (good, fair, poor, unusable)
Status (ready to use, in use, lost)


90% of the time users want to enter a Tool ID to retrieve the Storage 
Location, Condition, and Status.  10% of the time they know the tool type 
but don't know the tool ID and want to query for a tool to do the job, 
using one or several attributes.  I've been thinking that because there 
are so many tool types and so many attribute "collections", an object 
field might be a good place to store the attribute data in name-value 
pairs.  This way I don't have to have a table with every single attribute 
name, which would be a problem because I don't know them in advance (users 
want to be able to specify the attributes themselves, along with the 
attribute value of course) and many tools do not share many attributes, so 
a big mostly-empty record would result if I used fields.

The object field on a record with Tool Type = "screwdriver" would contain 
attributes for a screwdriver, while the object field on a record with a 
different Tool Type would contain a different set of attributes.  A table 
for "Tool Type" would have one record for each tool type and could also 
use an object field to contain the attribute names, since this would be 
more handy than having multiple records for each tool type, one for each 
attribute name.  The normalized, relational model isn't really needed 
here, though of course it could be used.

An object field seems ideal for this kind of application, and 'Query by 
Attribute' certainly makes it possible.

There are always LOTS of ways to solve a problem, but do you agree that an 
object field is a good way to solve this one?  If it is a mediocre way to 
solve it, I'd like to hear your comments!


Bob Miller
Chomerics, a division of Parker Hannifin Corporation 



**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to