Page 1 of 1

Bulk adding source data

Posted: 20 Sep 2014 05:43
by craigmollekin
Hi,

Is there any way to add the same source data to multiple records?

The only way I can currently think of is by exporting a Gedcom to a new Gedcom with the new source data and then merging it back.

Re: Bulk adding source data

Posted: 20 Sep 2014 09:17
by tatewise
Do mean adding a Citation to the same Source Record from many Individual Records or Facts.

If so, then Copy an existing Citation and Paste it wherever you want it using the Copy and Paste icons/buttons on the yellow Sources pane.

Re: Bulk adding source data

Posted: 20 Sep 2014 09:22
by craigmollekin
No, I mean I have 4500 people that I'd like to add a citation to ;-)

Re: Bulk adding source data

Posted: 20 Sep 2014 11:29
by DavidNewton
Although this may not be what you are looking for it seems to me that if you are making 4,500 copies then you should consider creating a source (Method 1) rather than a citation (Method 2). Attaching a source to a list of people, as a <whole record> source is fairly simple as a plugin - with a bit of preparation.

1. Create the source
2. Create a named list of the individuals
3. Run the following rough and ready plugin

fs=fhNewItemPtr()
tsour=fhPromptUserForRecordSel('SOUR',1)
tsel=fhPromptUserForRecordSel('INDI')
for i=1, #tsel do
fs=fhCreateItem('SOUR',tsel,true)
fhSetValueAsLink(fs,tsour[1])
end

When the plugin asks for the list go to the Named lists tab and double click your named list.
I'm afraid I don't have a file with 4,500 individuals so cannot test this on a data set of that size so take the usual backup precautions should you decide to try it.

David

Re: Bulk adding source data

Posted: 20 Sep 2014 13:04
by tatewise
Yes, that Plugin approach is the neatest method.

It results in every one of the 4,500 Individual Records having a <whole Record> Citation, and each one links to the chosen Source Record.

I have tried it on some sample data and it certainly works fine.

I am fascinated as to why all 4,500 have a common Source.

Re: Bulk adding source data

Posted: 21 Sep 2014 00:46
by craigmollekin
Thanks for the replies and for creating that, David. I will try it in the next few days and report back :)

The Gedcom in question contains 4500ish people transcribed from headstones from a single person. I just wish to acknowledge them as the source of the data before adding additional data to it :D

Re: Bulk adding source data

Posted: 21 Sep 2014 08:29
by PeterR
If it was me, I would have each headstone as a Source record, with citations by one or more Individuals or Families, and by one or more Facts (birth, death, etc.) for each Individual. Presumably there are a lot less than 4,500 headstones and thus Source records. A Source record cannot itself have a Source, but they could all have an Author. I'm sure the Plugin can be adapted to do that instead.

Re: Bulk adding source data

Posted: 21 Sep 2014 08:41
by craigmollekin
Well, I took the photos of the headstones but somebody has transcribed the names and dates for me from the photos of the headstones. I'm just wanting the transcribed data to be associated with the person who transcribed them :-)

Re: Bulk adding source data

Posted: 21 Sep 2014 09:10
by DavidNewton
I do agree about the citations but I also think as far as possible we should avoid repetition of details. I don't know if this is relevant but I have a transcription list of memorials and a source record which contains all the common details and then use citations to refer to the individual items. (I am certain that everyone will have their own way of detailing this).

David

Oh and before anybody else points it out I will be changing the image location to a more appropriate Sources > BMD :(

Re: Bulk adding source data

Posted: 21 Sep 2014 09:29
by tatewise
Follow-up on the PeterR comment "A Source record cannot itself have a Source, but they could all have an Author."

It is true a Source Record cannot have a Source, but its Note field can cite a Source.
Unfortunately, this Citation does not appear in the yellow Sources pane of the Source Record Property Box.

Alternatively, a Source Record can link to a Note Record which appears on the Notes tab of its Property Box.

I assume Craig does have a separate Source Record for each tombstone.
So I would be tempted to create a Note Record detailing the transcription acknowledgements.
Then link this one Note Record to each Source Record using the Plugin method.

Code: Select all

fs=fhNewItemPtr()
tnote=fhPromptUserForRecordSel('NOTE',1)
tsel=fhPromptUserForRecordSel('SOUR')
for i=1, #tsel do
 fs=fhCreateItem('NOTE',tsel[i],true)
 fhSetValueAsLink(fs,tnote[1])
end

Re: Bulk adding source data

Posted: 27 Mar 2022 19:42
by tLeodiensian
I'd love to use this as it is exactly what I want to do.
I have a named list and want to add a source link to all the individuals in it (~ 250).

1. Create the source
2. Create a named list of the individuals
3. Run the following rough and ready plugin

fs=fhNewItemPtr()
tsour=fhPromptUserForRecordSel('SOUR',1)
tsel=fhPromptUserForRecordSel('INDI')
for i=1, #tsel do
fs=fhCreateItem('SOUR',tsel,true)
fhSetValueAsLink(fs,tsour[1])
end

When the plugin asks for the list go to the Named lists tab and double click your named list.


However, when I run it I get a plugin error :-
"path_to_script....];5: bad argument #2 to 'fhCreateItem' (fh.PITEM expected, got table). No changes made...."

What is the change needed in the above code to allow the loop to read from a named list (aka a table) instead of selecting separate individuals, as seems to have been David Newton's original intent ?

I don't claim to be coder, MD-DOS batch files or Linux bash scripts are my limit, so I'd like some help here.
I also see that this was posted in 2014, and FH has moved on, so there might need to be other tweaks. I'm on latest V7.

Thanks in advance

Re: Bulk adding source data

Posted: 27 Mar 2022 20:15
by tatewise
That is a near-perfect first shot.

The problem is the tsel variable that is a table or array of pointers to the Individual records selected using the Named List.
Whereas, the fhCreateItem(...) function needs just one of those pointers, not the whole table.
Similar to the way you chose tsour[1] as the source pointer.
You could have used:

Code: Select all

fhCreateItem('SOUR',tsel[i],true)
but there is a neater way, so replace the for i=1, #tsel do and fhCreateItem(...) statements with:

Code: Select all

for i, psel in pairs (tsel) do
fs=fhCreateItem('SOUR',psel,true)

Re: Bulk adding source data

Posted: 27 Mar 2022 20:46
by tLeodiensian
Thanks,

Just what I wanted, and so quick to reply.

Thanks again.

Doug