DataMgr 2.5 Documentation: Labels


Label Relation Fields allow you to retrieve a single related field from another table. For example, you could have a "Category" field that gets the value of the "CategoryName" field from a categories table based on a foreign key field in the current table.

Label relation fields are also using in saving data. So, if you pass in a value for "Category" (in our example) and a record in the categories table has a category name of the same value, then the foreign key field will be set to the appropriate value to indicate that category name.

If you add an "onMissing" value of "insert", then DataMgr will attempt to create a record in the related table for a new value if such a row doesn't already exist.



<field ColumnName="Category">
	<relation type="label" table="Cats" field="CatName" join-field="CatID" />

The Label Relation Field has an optional "onMissing" attribute to specify how DataMgr should behave if a value is passed in for this field that doesn't have a matching value in the related table.

"ftable" attribute

Note that the "join-field" attributes could be eliminated with the use of the "ftable" attribute.