This post originated from an RSS feed registered with PHP Buzz
by Forum One.
Original Post: The Magic of Type
Feed Title: Syntax Framework
Feed URL: http://blog.syntaxcms.org/rss.php?version=0.91
Feed Description: Finally, a place to answer Syntax questions
One of the cool features of Syntax, left over from its F1DB days, is the variable type field for each object.
The upshot is that, by default, when you use the typedbfield in an object, Syntax automagically looks for a picklist with the name of the datatype in it, in this format:
{name of object}types
So if you have a datatype called "article," the corresponding type picklist would be articletypes.
This is really useful, because it allows each datatype to have its own picklist of types--eventtypes, articletypes, puddingtypes--but only use one field in the master records table.
Otherwise, you'd have to make a new dbfield entry for each type you had, and they'd be available to other datatypes--which is silly when your datatype is blancmange and your list is puddingtypes (Blood, Yorkshire, Figgy).
However, with great power comes great responsibility. If you set up a new datatype and you choose to repurpose the typedbfield, you'll be up a creek.
But what if you'd like another such field?
Then you need to investigate the "Variable Table" feature of DBasis when creating that dbfield entry. So far, to my knowledge, it only accepts one variable:
$(objecttype)
The setup for the typedbfield is:
pickid variable table $(objecttype)types
Any text before or after $(objecttype) will be used when constructing the name of the pick table to look for. So my($objecttype)ingredients would result in myarticleingredients, myeventingredients, and of course, myblancmangeingredients.
Generally, of course, you'll find just the one default typedbfield more than sufficient.