Subscribe to DataMgr |
Visit this group |
List Relation Fields allow you to automate the handling of many-to-many relationships using lists. This essentially automates the saveRelationList() method with the added benefit that it brings the list into the recordset returned by getRecords().
You can filter by this value as well, limiting the recordset to records that have at least one of the list items given (so the longer the list you pass in to this key, the more results you are likely to get).
<field ColumnName="Items">
<relation
type="list"
table="items"
field="item_id"
join-table="rec2items"
join-field="rec_id"
/>
</field>
The above example assumes that the join-table has a field of the same name as the primary key field of your main table and that the "join-field" field is the other key field in the join-table and exists in the table indicated in the "table" attribute.