Changes between Version 17 and Version 18 of MolgenisAddressBookExample


Ignore:
Timestamp:
2009-08-23T18:54:06+02:00 (15 years ago)
Author:
Morris Swertz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MolgenisAddressBookExample

    v17 v18  
    5454}}}
    5555
     56== 4. Similarly create a “Address” data type (to keep it simple we only do phone numbers): ==
     57 * Entity address
     58{{{
     59!xml
     60<entity name="Address">
     61}}}
     62 * A unique, automatic numeric identifier field that MOLGENIS will use to refer addresses.
     63{{{
     64!xml
     65<field name="address_id" type="autoid"/>
     66}}}
     67 * Add the phone number field:
     68{{{
     69#!xml
     70<field name="phone"/>
     71}}}
     72 * Add a field where the user can choose from an enumeration of options whether the address is ‘home’,’work’,or ‘mobile’:
     73{{{
     74#!xml
     75<field name="address_type" type="enum" enum_options="[home,work,mobile]"/>
     76}}}
     77
     78== 5.   Finally we need to link the Addresses to each Contact. ==
     79{{{
     80#!xml
     81<field name="contact" type="xref"     
     82         xref_field="Contact.contact_id"       
     83         xref_label="displayname"/>
     84</entity>
     85}}}
     86Note that the xref_field refers to unique field ‘contact_id’ in entity ‘Contact’. The xref_label attribute indicates that we want to view references to Contact by ‘displayname’ name instead of the numeric id. 
     87
     88Use of a meaningless numeric ‘id’ next to a meaningful ‘label’ enables us to change the ‘displayname’ name on Contact without the problem of also having to change this on each Address that refers to this contact.