Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

There are certain name layouts that come with OpenMRS right now, they are: short (default), long, givenfamily, latinamerica and spain.  These are stored in the openmrs-servlet.xml file. You can find this file in tomcathome/webapps/openmrs/WEB-INF/lib/openmrs-web...jar/openmrs-servlet.xml .

You can modify the layout.name.format global property   setting  (formerly global property from platform 1.8 downwards) to one of those values or to the "codeName" of a new custom layout (instructions below) to see a different name layout.

...

These are the name layouts that come with OpenMRS. The following table shows which items are contained in each of them (they are ordered from shortest to longest).

...


codePrefixGiven NameMiddle NameFamily Name PrefixFamily NameFamily Name 2Family Name SuffixDegree 
givenfamily
 

X
 
 


X
   



short 
 

XX
 

X
   



spain 
 

X
  


XX
  


latinamerica 
 

XX
 

X
  


long 

Adding/Overriding existing NameTemplate

  1. Add a new

...

  1. Global Property named "layout.name.template" if it already exists, update it's value to the your custom xml template: 

    Code Block
    <org.openmrs.layout.name.NameTemplate>
      <codeName>customXmlTemplate</codeName>
      <displayName>Custom Name Format</displayName>
      <nameMappings class="properties">
        <property name="prefix" value="PersonName.prefix"/>
        <property name="givenName" value="PersonName.givenName"/>
        <property name="familyName" value="PersonName.familyName"/>
      </nameMappings>
      <sizeMappings class="properties">
        <property name="prefix" value="5"/>
        <property name="givenName" value="30"/>
        <property name="familyName" value="25"/>
      </sizeMappings>
      <lineByLineFormat>
        <string>prefix</string>
        <string>givenName</string>
        <string>familyName</string>
      </lineByLineFormat>
      <requiredElements>
        <string>givenName</string>
        <string>familyName</string>
      </requiredElements>
    </org.openmrs.layout.name.NameTemplate> 


  2. Change the nameMappings, sizeMappings, and lineByLineFormat elements however you like.
  3. Update the  layout.name.format  Global Property to the custom template's codeName so that it is chosen as the active template.


e.g. if you don't want to show prefix, you delete the lineByLineFormat line: <string>prefix</string>

e.g. if you want to have a longer givenName, you modify <property name="givenName" value="30"/> to be <property name="givenName" value="50"/>