* Insert PLACE Field

Questions regarding use of any Version of Family Historian. Please ensure you have set your Version of Family Historian in your Profile. If your question fits in one of these subject-specific sub-forums, please ask it there.
Post Reply
User avatar
davidm_uk
Megastar
Posts: 740
Joined: 20 Mar 2004 12:33
Family Historian: V7
Location: St Albans, Hertfordshire, UK

Insert PLACE Field

Post by davidm_uk » 23 Jan 2015 14:13

I've now tidied up all my Adresses and Places, and I currently have the PLACE records with the default 5 fields. At the moment I'm only using the first 3 fields:

Part 1 Town
Part 2 County
Part 3 Country

I'm thinking about changing this to use 4 fields:

Part 1 Village/District
Part 2 Town/City
Part 3 County
Part 4 Country

I'd like to do a sort of global edit to just shift all the existing place data over by one field, leaving Part 1 empty.

I think I can see a way of doing this by loading a copy of the Gedcom into Excel (as a text file), filter all the lines to show where PLAC is used, and then inserting a comma before the first character following PLAC.

PLAC seems to appear in only two forms:

2 PLAC Lambeth, London, England
0 @P1@ _PLAC Lambeth, London, England

So the result will be:

2 PLAC ,Lambeth, London, England
0 @P1@ _PLAC ,Lambeth, London, England

Is there an easier way to achieve this within FH, or any "gotchas" to watch out for?

Second part of the exercise will be to move some, but not all, parts of the Address fields over to the empty PLAC Part 1 fields. Looks a bit more complicated, but one step at a time!
David Miller - researching Miller, Hare, Walker, Bright (mostly Herts, Beds, Dorset and London)

User avatar
davidm_uk
Megastar
Posts: 740
Joined: 20 Mar 2004 12:33
Family Historian: V7
Location: St Albans, Hertfordshire, UK

Re: Insert PLACE Field

Post by davidm_uk » 23 Jan 2015 14:36

Oh POO!

Looks like Excel, even just keeping the data as text, doesn't like Unicode.

The resulting text file (viewed with NotePad) has a #Value" error at the end of every line, even lines that haven't had the , inserted.
David Miller - researching Miller, Hare, Walker, Bright (mostly Herts, Beds, Dorset and London)

User avatar
jimlad68
Megastar
Posts: 911
Joined: 18 May 2014 21:01
Family Historian: V7
Location: Sheffield, Yorkshire, UK (but from Lancashire)
Contact:

Re: Insert PLACE Field

Post by jimlad68 » 23 Jan 2015 14:40

I'm sure this could be done more "accurately/ efficiently" with a plugin, but don't ask me how.

I like the idea of editing (running macro or other text manipulating program) the GEDCOM file direct, but I am always concerned that without full understanding of the task in hand, it might be easy to mess things up.

I'm not sure what the implications would be of exporting your whole Gedcom file to spreadsheet (or say "text" file in word), editing, then back again to Gedcom, would it upset the file structure etc.

If you do find a good method for this, please let us know as PLACe/ ADDRess manipulation is something that would be very useful, especially with the new geocoding functions.
Jim Orrell - researching: see - but probably out of date https://gw.geneanet.org/jimlad68

User avatar
jimlad68
Megastar
Posts: 911
Joined: 18 May 2014 21:01
Family Historian: V7
Location: Sheffield, Yorkshire, UK (but from Lancashire)
Contact:

Re: Insert PLACE Field

Post by jimlad68 » 23 Jan 2015 15:53

David, I did a quick test myself and had no problems reading into excel 2010 via text import (it did say Windows ANSI, make sure you choose delimited then remove them at the next step.

I then filtered as you suggest and edited fine. then saved as text (it defaulted to unicode). However on import to FH either as a new Gedcom or replacing the original FH progect Gedcom I got many many errors like:
Record Type=Individual. Gedcom Id=I2. Record Number=2.
l.99 - EXCLUDED: invalid line : ""2 PLAC St Aidan's C.E. School, Preston-Bamber Bridge, Lancashire, , England,""


But then I noticed excel had added many " " to the lines.

To get around this you need to:
- Ensure you remove the filter before saving
- Save as formatted text, space delimited (this seems to be a handy way of just saving your filtered data to a prn(text) file.
- alter the *.ext from prn to *.ged.
- replace the file in your project. #### ENSURE THIS IS A TEST OR YOUR ORIGINAL PROJECT BACKED UP ####

This seemed to work OK with no funny messages from FH, but I would be reluctant to do it on my master gedcom file until it has been proved.

However, when I looked at this in Notepad++ it showed encoding as ANSI, yet FH did not object to this ANSI file (confirmed by being half the size of the original). If I then made a change to some detail, FH then saved it as "UCS-2 Little Endian" (according to Notepad++), same as the original.
I should add that I don't think I have any non ANSI characters.

So next step is to experiment with non ANSI characters to see if that would force excel to save as "UCS-2 Little Endian" (which I assume is Unicode?).

I will have a look around, as this could be a quick simple method for block changes.
Jim Orrell - researching: see - but probably out of date https://gw.geneanet.org/jimlad68

User avatar
jimlad68
Megastar
Posts: 911
Joined: 18 May 2014 21:01
Family Historian: V7
Location: Sheffield, Yorkshire, UK (but from Lancashire)
Contact:

Re: Insert PLACE Field

Post by jimlad68 » 23 Jan 2015 16:20

OK fixed the save to "UCS-2 Little Endian"/Unicode issue.
from here if you are interested, so simple when you step back! http://superuser.com/questions/349882/h ... as-unicode

After making your amendments in excel:
- Open in a text editor (I used Notepad++) any valid FHv6 project Gedcom file (a copy will do). This forms the basis of a valid FHv6 Gedcom File.
- delete everything
- in excel, copy all rows in first column (ctrl+A seemed to work OK) - might take some time for a large Gedcom
- paste that into the text editor file (might take some time).
- save this file and rename to the original and use it instead of the original.

And I repeat "I would be reluctant to do it on my master gedcom file until it has been proved."

It would be nice to hear of any other direct file methods without having to resort to LUA and Plugins.
Jim Orrell - researching: see - but probably out of date https://gw.geneanet.org/jimlad68

User avatar
davidm_uk
Megastar
Posts: 740
Joined: 20 Mar 2004 12:33
Family Historian: V7
Location: St Albans, Hertfordshire, UK

Re: Insert PLACE Field

Post by davidm_uk » 23 Jan 2015 16:28

I think Excel doesn't like Unicode.

PSPad has been recommended on here in the past, and supports Unicode. I've downloaded and installed it, used it to do a search and replace of

"PLAC " with "PLAC , "

and that seemed to work. FH loads it ok, and work-with-places now shows the empty Part 1 field, with my existing places moved across to the following fields.

Oh, and yes I did it on a copy of my Gedcom, just in case.

Unfortunately, when installing PSPad, and despite declining the offers of "extras" to install, I've ended up with the VOPackage.exe malware (and one other remote desktop connection thing). I'm now distracted fighting the battle to remove those!!!
David Miller - researching Miller, Hare, Walker, Bright (mostly Herts, Beds, Dorset and London)

User avatar
BillH
Megastar
Posts: 2179
Joined: 31 May 2010 03:40
Family Historian: V7
Location: Washington State, USA

Re: Insert PLACE Field

Post by BillH » 23 Jan 2015 16:33

Couldn't you just use a text editor, I use Editpad Lite, and make the following changes.

Change "2 PLAC " to "2 PLAC , "
Change "0 @P1@ _PLAC " to "0 @P1@ _PLAC , "

In both cases be sure to include the space after PLAC.

Bill
Last edited by BillH on 23 Jan 2015 23:26, edited 1 time in total.

avatar
jbtapscott
Superstar
Posts: 483
Joined: 19 Nov 2014 17:52
Family Historian: V7
Location: Corfu, Greece
Contact:

Re: Insert PLACE Field

Post by jbtapscott » 23 Jan 2015 17:17

I used the Search / Replace option in Notepad++ to modify a number of lines in the Gedcom file I exported from TMG - this included changes of the type you were talking about.
Brent Tapscott ~ researching the Tapscott and Wallace family history
Tapscott & Wallace family tree

User avatar
jimlad68
Megastar
Posts: 911
Joined: 18 May 2014 21:01
Family Historian: V7
Location: Sheffield, Yorkshire, UK (but from Lancashire)
Contact:

Re: Insert PLACE Field

Post by jimlad68 » 23 Jan 2015 17:30

David, re: " I've ended up with the VOPackage.exe malware"
seehttp://www.bleepingcomputer.com/forums/ ... ram-pspad/

this is the legit site http://www.pspad.com/en/download.php

However, I always look here first because they are "portable" so you can install away from your c: drive and more importantly without "extras" and if you use the Liberkey menu, update automatically.
http://www.liberkey.com/en/catalog-flat-list-view.html
see also http://portableapps.com/apps
and http://www.portablefreeware.com/index.php?id=1295
Jim Orrell - researching: see - but probably out of date https://gw.geneanet.org/jimlad68

User avatar
BillH
Megastar
Posts: 2179
Joined: 31 May 2010 03:40
Family Historian: V7
Location: Washington State, USA

Re: Insert PLACE Field

Post by BillH » 23 Jan 2015 18:19

David,

I see that you were already trying what I was suggesting... we were both replying at the same time and our messages crossed.

Good luck with your malware problem. I use Malwarebytes which I've found very good at preventing Malware from even getting on my computer in the first place.

Bill

User avatar
jimlad68
Megastar
Posts: 911
Joined: 18 May 2014 21:01
Family Historian: V7
Location: Sheffield, Yorkshire, UK (but from Lancashire)
Contact:

Re: Insert PLACE Field

Post by jimlad68 » 23 Jan 2015 23:18

David, Bill,

I am no expert in this, but if you want to use a text editor, (make sure it opens Unicode, Notepad++ does but I'm not sure about PSPad), to ensure you get only lines that begin with "2 PLAC" try this after switching on regular expression find/replace:
"^2 PLAC " to "2 PLAC , " or whatever (the ^ signifies start of line)

to find more than 1 search string in a line and then change one part of it:
say "Chorley, Lancashire" to "Chorley, Lancs" on lines beginning with "2 PLAC "

"^(2 PLAC .*) Chorley, Lancashire(.*)" to "\1 Chorley, lancs\2"
-- Whatever is contained within the first () gets stored in \1, the second in \2 and so on.
-- .* means anything inbetween.

I think LUA uses similar but different "expressions".
Jim Orrell - researching: see - but probably out of date https://gw.geneanet.org/jimlad68

User avatar
davidm_uk
Megastar
Posts: 740
Joined: 20 Mar 2004 12:33
Family Historian: V7
Location: St Albans, Hertfordshire, UK

Re: Insert PLACE Field

Post by davidm_uk » 25 Jan 2015 12:55

Well I've now managed to clean the malware from my PC and can can back to the original task!

I've posted some info about dealing with malware here: http://www.fhug.org.uk/forum/viewtopic.php?f=38&t=12246 if anyone's interested.

Having used PSPad to edit a copy of my Gedcom, it worked ok, and I've now populated the village/district into Place Part 1 and removed it from the Address record.

I did this the hard way by using Work with Addresses, find the one I wanted to change, click the Where Used button, then double click each entry in turn and edit the properties box - fact tab entry(s) to update the Place and Address. Tedious or what, especially as the Work with Addresses window closes after you click the Where Used button.

I now just need to do another pass through Addresses to add an additional bit of information to church names to distinguish one from another.
David Miller - researching Miller, Hare, Walker, Bright (mostly Herts, Beds, Dorset and London)

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

Re: Insert PLACE Field

Post by tatewise » 25 Jan 2015 13:22

That is the hardest way possible to make those changes.
All you need to do is use the Edit button and all the matching Fact fields automatically get changed.

Try clicking the Help button and it explains that is how to do it.

I am surprise how little the Help button in all the FH dialogues gets used.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
davidm_uk
Megastar
Posts: 740
Joined: 20 Mar 2004 12:33
Family Historian: V7
Location: St Albans, Hertfordshire, UK

Re: Insert PLACE Field

Post by davidm_uk » 25 Jan 2015 15:38

Yes, but the edit button only lets me change the address record. If I want to move one of the Address fields to a Place field, for example:

Address: 12 Smith Road, Brixton
Place: , Lambeth, London, England

to become:

Address: 12 Smith Road
Place: Brixton, Lambeth, London, England

I can't do this with just editing the address record, and I can't simply change all the , Lambeth, London, England entries to Brixton , Lambeth, London, England because the former is still valid (or that's all I know) for some facts. I think I have to do the change individually for all facts.

Maybe there's an easier way, I'd love to know it!
David Miller - researching Miller, Hare, Walker, Bright (mostly Herts, Beds, Dorset and London)

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

Re: Insert PLACE Field

Post by tatewise » 25 Jan 2015 17:13

I was going to suggest that if Plugin literate, that would be a quick way, and it would be easiest to use the =TextPart() function to extract the desired comma separated parts.
BUT there appears to be a bug that prevents that =TextPart function from being called via a Plugin.
It is still feasible, but rather more complex.
So I will be reporting that bug to Calico Pie.

The way I would tackle it is from a Query Result Set for all Place and Address fields in all Facts.
Start from the Standard Query for All Facts and create a Custom Query that only lists the Place and Address fields with both sorted in Ascending order.
That will group all identical pairs of Place and Address together.

If any Place is only ever paired with one Address then a simple Edit in Work with Data > Places will do.
Otherwise, each Place will need changing via the Result Set as you described above.
Remember to include a blank part 1 for empty Addresses.

Finally, when all Places have been changed, then a simple Edit in Work with Data > Addresses will do for each Address.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

Post Reply