Page 1 of 1

Moving Place data to Address Field

Posted: 23 Nov 2012 21:16
by jayef
I have been sent an FH database containing a goodly amount of my family history data - 380 individuals - (lucky me!). I see that ALL the 'location' data has been entered into the Place fields and the Address fields are blank.

As I understand: Place should contain the Town, County, Country information and the 'details' (Church name, Street Address etc) should be in the Address field. And I can see the logic for this so would like to standardise this data before I add more.

As all the data is basically present is there some way that I can automate or simplify the necessary editing and avoid individually editing the records and re-entering data which already exists (but in the wrong place)? I can see that the 'Tools/Work with Data' feature may be relevant but couldn't see how to use it to address this problem.

I have many years of IT experience so happy with something reasonably technical if that's what's needed.

(I found a number of posts about Place/Address usage but couldn't find anything specifically addressing this problem)


ID:6606

Moving Place data to Address Field

Posted: 23 Nov 2012 21:53
by PeterR
I would think that a Plugin could be written, but you would have to be able to specify how many comma-separated parts at the start of the Place field should be moved to the Address field.  Obviously this specification would have to apply either to all records or to a specified subset of records, e.g. if you could specify which records need one rather than two Place parts moved.  It might be easier to specify how many parts at the end of the Place field should be retained, with the remainder moved to the Address.

Obviously you should experiment with a copy of your data until satisfied with the result.

Moving Place data to Address Field

Posted: 23 Nov 2012 22:35
by tatewise
Now that is an interesting challenge !

The one thing you cannot do is transfer entries from Tools > Work with Data > Places to Tools > Work with Data > Addresses as these are simply a summary of what is currently in all the Place and Address fields.

The solution partly depends on how organised, or disorganised, the Place data is, and how many different entries exist in Tools > Work with Data > Places.

I suspect the best initial option is to write a small Plugin to copy every Place field to its associated Address field.
If the current Place data is in organised Columns, then some left-hand Columns could be removed from every Place and some right-hand Columns removed from every Address during the copying process.

See Tools > Plugins > More>> > How to Write Plugins + How to Write Plugins and the rest of this help for starters.
See Plugin Code Snippets for coding ideas.

After that use Tools > Work with Data > Places and Tools > Work with Data > Addresses to refine individual entries further.

Moving Place data to Address Field

Posted: 24 Nov 2012 00:09
by tatewise
The Copy Place to Address ATTACHMENTS Plugin below will copy every PLAC field to its associated ADDR field providing it's empty.

To manipulate only comma separated parts:
Use strText = fhGetValueAsText(ptrItem) to obtain Place string.
Use Split A Line Using A Separator i.e. tblPart = strText:split(',')
Then join the left-hand split parts together using strText = tblPart[1]..','..tblPart[2]..','..tblPart[3]
Use isOK = fhSetValueAsText(ptrAddr,strText) to save the result
To join right-hand split parts use strText = tblPart[#tblPart-2]..','..tblPart[#tblPart-1]..','..tblPart[#tblPart]
where #tblPart is the size of the table

Moving Place data to Address Field

Posted: 24 Nov 2012 11:09
by jayef
Mike

Thank you so much. What an excellent team is clearly on board here. Further vindicates my selection of FH

Something like that plugin is /exactly/ what was in the back of my mind and I have enough programming background to get my head round it and tweak if required. It would have taken me some time to generate myself from a standing start (but you have whetted my appetite!)

When I have the data duplicated it should be fairly straightforward to edit the two fields, probably using the Work With Data tools. I had deduced, as you confirm, that it was not possible to use this facility to transfer data between the fields.

Thanks again for such a prompt and helpful response (and Peter for your insight also)