DataMgr 2.0 Documentation: Lists

Lists

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).

Attributes/Keys:

  • type (required): "list".
  • table (required): Name of table from which you will pull a list of values.
  • field (required): The name of the field which will hold the values for the list.
  • join-table (optional): If you need to pull values for a many-to-many relationship, the table that indicates the relationships between the local (main) table and the remote (related) table.
  • join-field (optional): If the join-table has a field matching the primary key field of your local table and a field matching the field on which you want to join in the remote table, use join-field to indicate the field joining the remote table to the join-table. Otherwise use the keys below.

Example:

<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.