Terry's ORA Tips

Template Example – Enhanced City Names

This page created 29 May 2020

Version note: Applies to ORA 1.00

This article describes one of my example Templates for Online Repository Assistant (ORA). The other example Templates can be found in the index of Example Templates. Other articles in my ORA Section cover various topics about using the software. The "How it Works" section below includes links to articles describing the ORA features used in this Template.


Many collections provide place names in a single field containing the names of several place levels, for example: city, county, and state. My example for Extracting U.S. Place Names describes some methods for separating those place parts.

Extracting the name of the city can be complicated by the fact that within a collection the name of the city may be omitted, or have appended information about sublevels like districts or ward. Or the names of territories used in the collection that are not generally recognized place names may appear instead of a city name, which we may not want to record, depending on where we are recording the data. This article describes some methods for addressing those issues.

This Template attempts to extract the city name in the desired form from such multi-level place fields. For example, a quick review of place names from the 1860 U.S. Federal Census as recorded by Ancestry.com included these:

Place as Recorded Desired City Name
Jackson, Shelby, Indiana Jackson
Newburyport Ward 5, Essex, Massachusetts Newburyport
Warren, Tennessee {none, no city shown}
District 16, Sullivan, Tennessee {none, not a city}
Northem District, Chesterfield, Virginia {none, not a city}

Locality names do appear in other forms, which this Template may not successfully deal with, but the methods illustrated may be adaptable to those cases.


Text or Auto Type


For a Text Template, in the ORA Control Panel in the browser window containing the record of interest, click the icon of this Template to copy the data to the clipboard. Then open the census event or citation data input screen of your genealogy program and paste it in the desired field.

If used as an Auto Type Template, place the cursor in the desired field in the genealogy program and click the appropriate Auto Type button in the ORA Control Panel.

This Template may also be included as a segment of a more comprehensive Template.

How it Works:

This Template uses the Alternatives Conditional feature to test for various formats in turn, and if not found moves to test the next. Within each segment, it uses the :split Transform to test various parts of the field, and in some cases output data from the field. In the illustration below the opening and closing Conditional brackets and the bar used to separate Alternatives are in pink.

<[?:Residence:splitCount:,=2]|[?:Residence:split: :2=ward][Residence:split: :1]|[?:Residence:split: :1=district]|[?:Residence:split: :2=District,]|[Residence:split:,:1]>

The Template uses the :split Transform in a number of ways; sometimes counting from the beginning and sometimes from the end of the field. Some of the counts would have to be adjusted if the country name was included in the field. It also takes advantage of the fact that major place levels are separated by commas while sub-parts of the city name are separated by spaces. The function of each of the segments of the Alternatives expression is explained below:

  1. [?:Residence:splitCount:,=2]
    Counts the number of elements, evaluating as true if there are two, which happens if only the state and county names are present, and there is no "city" name. Since there is no output term in this segment, if this segment tests as true it completes the Alterative Conditional with no output.
  2. [?:Residence:split: :2=ward][Residence:split: :1]
    Checks for the second term in the field, when separated by a space character, being equal to "ward" – if true outputs the first term when separated by a space. This completes the Alterative Conditional expression.
  3. [?:Residence:split: :1=district]
    Checks for the first term in the field, when separated by a space character, being equal to "district" – if true completes the Alterative Conditional expression with no output.
  4. ?:Residence:split: :2=District,]
    Checks for the second term in the field, when separated by a space character, being equal to "district," – if true completes the Alterative Conditional expression with no output.
  5. [Residence:split:,:1]
    Outputs the first term when separated by a comma. This segment will be used if all previous segments have evaluated as false.

The Template will, of course, not always be successful in extracting the city name as desired. For example, I have found these additional place names in the 1860 census that will not be successfully dealt with by this Template: "Township 3 S Range 3 W, Washington, Illinois," and "Upper Revenue District, Hanover, Virginia." Additional terms could be added to deal with them, but there are no doubt others as well. At some point it may be best to accept that some manual correction of Template results is better than expending the additional effort automate the extraction of the data.


The following is the complete Template. It can be copied from the area below and pasted into either a Text Template or Auto Type Template in the OraSettings window.

<[?:Residence:splitCount:,=2]|[?:Residence:split: :2=ward][Residence:split: :1]|[?:Residence:split: :1=district]|[?:Residence:split: :2=District,]|[Residence:split:,:1]>


ReigelRidge Home Terry's Tips Home Contact Terry



Copyright 2000- by Terry Reigel