Determine When to Use State or Commonwealth

From HotDocs Wiki

Jump to: navigation, search

Some states in the United States are officially recognized as "commonwealth" states. In some documents, this means you must decide when to use State of and when to use Commonwealth of before the state's name:

   The State of New York
   The Commonwealth of Pennsylvania

You can use a computation to automatically determine which term to use for the selected state.

The following computation examines the user's answer for the State Name variable and compares it with the list of four commonwealth states. The computation then attaches the correct designation to the merged answer.


IF "massachusetts virginia kentucky pennsylvania" CONTAINS State Name
  "The Commonwealth of «State Name»"
  "The State of «State Name»"

Sate Name A Multiple Choice variable with options for each of the 50 states.

At first glance, this computation may seem backward. You may think you would test State Name to see if it contains any of the commonwealths listed in the text string (for example, IF State Name CONTAINS "massachusetts virginia kentucky pennsylvania"). However, if you used that method, the answer the user assigns to State Name would have to contain everything between the quotation marks—"massachusetts virginia kentucky pennsylvania"—and you would never produce a true statement. Of course, you could test State Name against each individual commonwealth (for example, IF State Name CONTAINS "massachusetts" OR IF State Name CONTAINS "virginia" and so forth), but by "switching" the values for the placeholders and placing all of the commonwealths in one text string, you eliminate a lot of repetitive typing.