* convert lower case surnames

For users to report plugin bugs and request plugin enhancements; and for authors to test new/new versions of plugins, and to discuss plugin development (in the Programming Technicalities sub-forum). If you want advice on choosing or using a plugin, please ask in General Usage or an appropriate sub-forum.
Post Reply
avatar
stuartd
Platinum
Posts: 40
Joined: 30 Oct 2012 21:20
Family Historian: V7
Location: Cumbria

convert lower case surnames

Post by stuartd » 03 Nov 2013 14:04

I have used the Plugin to convert surnames in all capitals to mixed case. However, I have many surnames that were originally entered in all lower case - they display OK in upper case when required, which is fine - but I would like to convert these also to the preferred mixed case format. The 'convert surnames' Plugin doesn't do this for names in all lower case. Would it be difficult to amend the Plugin to do this as well as, or would it mean writing a new one for this purpose?
I've never written any Plugins, but did take a look at the surname convert one via the Edit option, but I'm reluctant to start tinkering with it given that I don't know what would need to be changed.
Any suggestions for resolving the problem of this particular conversion would be much appreciated.
Kind regards, Stuart

User avatar
Jane
Site Admin
Posts: 8442
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Re: convert lower case surnames

Post by Jane » 03 Nov 2013 14:26

I took a quick look and if you change lines 51 and 52 replacing :upper with :lower to

Code: Select all

if strSurname == strSurname:lower() then
                strSurname = strSurname:lower()
and line 92 again replacing upper with lower to

Code: Select all

            tblSurname2['/'..line:lower()..'/']  = '/'..line..'/'


Please check the result set carefully and use the undo if needed.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

avatar
stuartd
Platinum
Posts: 40
Joined: 30 Oct 2012 21:20
Family Historian: V7
Location: Cumbria

Re: convert lower case surnames

Post by stuartd » 03 Nov 2013 14:40

Jane,

I saved a renamed copy of the Plugin and made the alterations you suggested. It has worked perfectly, including the handful of McNames in my records.
I appreciate your responding so quickly, and providing me with such a simple but effective solution.
Many thanks for your help.

Stuart
Kind regards, Stuart

User avatar
tatewise
Megastar
Posts: 27087
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: convert lower case surnames

Post by tatewise » 03 Nov 2013 16:13

Jane, if the following changes are made then the Plugin will convert both all /UPPERCASE/ and all /lowercase/ surnames at the same time.
Firstly replace lines 51 & 52 with:

Code: Select all

            if strSurname == strSurname:upper()
            or strSurname == strSurname:lower() then
(The original line 52 was redundant anyway.)

Secondly insert after line 92:

Code: Select all

            tblSurname2['/'..line:lower()..'/']  = '/'..line..'/'
Since all /UPPERCASE/ and all /lowercase/ surnames are distinct, there is no clash in the tblSurname2 table.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
Jane
Site Admin
Posts: 8442
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Re: convert lower case surnames

Post by Jane » 03 Nov 2013 18:17

I thought that was the case, but did not have time to check it in detail. I'll look at again on my return.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

User avatar
tatewise
Megastar
Posts: 27087
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: convert lower case surnames

Post by tatewise » 03 Nov 2013 19:14

I now realise that the line 52 that was redundant in original version, is now essential to avoid listing the same Mixed Case Surname twice, when both /UPPERCASE/ and /lowercase/ versions of the same Surname exist.
e.g.
/MUNRO/ and /munro/ will list Munro twice.

So line 52, now line 53, needs to be reinstated:

Code: Select all

                strSurname = strSurname:upper()
Lines 82 - 84 would benefit from becoming:

Code: Select all

if strList == nil
or strList:gsub("%s*","") == "" then
    -- Cancel Pressed or entire list deleted
    fhMessageBox('Update Cancelled')
else
Also, of course, some message text will need updating to accommodate both /UPPERCASE/ and /lowercase/ names.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

Post Reply