Tuesday, March 8, 2011

Authority Control. Well, sort of.

In our publications database we have American publications with the word “labor” in the title. We also have British, Canadian, Australian, and other publications with the word “labour” in the title. The problem was if you included “labor” in your title search you did not get titles with “labour” in them. The same held true for “employees” and “employes.” What I needed was for the database to return both when a researcher entered either.

Some if-then-else logic would probably work so that when you search for “Blah Blah Labor Blah” in the title the search is actually for:
(Title = “Blah Blah Labor Blah”) OR (Title = “Blah Blah Labour Blah”)

The solution I came up with is simpler, though not perfect. I run the search string through a function which replaces both “labor” and “labour” with “labo*r”. The wildcard will then match both “labor” and “labour”.

Public Function Authority(strKey1 As String)

      strKey1 = Replace(strKey1, "labor", "labo*r")
      strKey1 = Replace(strKey1, "labour", "labo*r")
      strKey1 = Replace(strKey1, "employee", "employe*")
      strKey1 = Replace(strKey1, "employe", "employe*")
     Authority = strKey1

End Function

No comments:

Post a Comment