Spaces/Official ESi/Scriptaculous & Adv. Tags

foreignkey

Andrew Donnan
posted this on November 25, 2008 13:00

<foreignkey table="Resources" />

Used to create a many-to-one relationship between tables. For example, the Resources board has two tables, Resources and Deployments. The Deployments input view has a foreignkey tag that links many deployments to a single resource.

Attribute

  • table: the name of the "one" table
  • type: can be set to select, causing a dropdown of records to be presented. If this attribute is omitted then the input view is assumed to be accessed from a viewlink tag that passes the foreign key value.
  • filter: used to filter a foreign key select list (see example below)
<foreignkey type="select" table="some_table" filter="field_name='some_criteria'"><eocfield type="fk" name="field_name" table="some_table"></eocfield></foreignkey>

Tip

  • Look at the sample Resources board a for a good example of foreignkey use.
  • For type="select" foreignkeys include a eocfield to populate the dropdown: (see example below)
<foreignkey table="Resource" type="select"><eocfield type="fk" table="Resources"></foreignkey>
 
Topic is closed for comments