Using Relational Data on Contenttype Fields

Release 1.0 - ...

Various webcontrols can display a list of data which origin is a pre-defined list, another table, a thesaurus or the content itself. Relations with datasources are created using these properties:

  • LookupList
  • ForeignKey
  • TableName (and other related properties)
  • ContentRelation
  • Thesaurus

Using these propeties immediatly create lists in the correct way. However, sometimes, the amount displayed data is to much. In that case, the LookupQuery property is helpful to create an alternative list.

  CopyCode image Copy Code
ForeignKey = "Users"
LookupQuery = "SELECT Nr, FullName FROM Users WHERE nr > 0"

In some cases, not the identity of the related table should be stored in the contents table, but another value of that related table. Assume a field Author which stored the fullname of the creator of an content-item. The author should be selected form a dropdownlist as well

  CopyCode image Copy Code
ForeignKey = "Users"
LookupQuery = "SELECT FullName, FullName FROM Users WHERE nr > 0"

From a Smartsite 5 point of view, this worked. However, Smartsite CMS Server is more strict. When the Foreignkey is used, you must stored the identity of the related table, as shown in the first example. When another value then the identity should be stored the implementation is slightly different:

  CopyCode image Copy Code
LookupQuery = "SELECT Nr, FullName FROM Users WHERE nr > 0"
EditProgID = "SixSmartui.Dropdownlist"