I wish to rename some of my Source Records. For Source Records beginning with a particular string (say, "Birth Certificate"), I wish to append the Record ID of the primary person it represents, and by that I mean the ID of the person that has the INDI.BIRT.SOUR data reference for that source record. The Source Record may be attached to a number of people and facts, i.e., primary person's birth place, mother's address, father's occupation, etc., but I'm not interested in those facts.
The way my data is structured, each Birth Certificate source record will have always have one and only one INDI.BIRT.SOUR; there may or not be other facts.
I've started a loop through the SOUR records, and tested SOUR.TITL to check for records that begin with "Birth Certificate". But I'm unsure how to obtain the Person ID which has the INDI.BIRT.SOUR as this appears to be in a different data structure?
A snippet of code just to make sure I was looking at the right records is below. I know this is very simple to our expert programmers here, so be gentle
Code: Select all
pi = fhNewItemPtr()
pi:MoveToFirstRecord("SOUR")
iCountBC = 0
while pi:IsNotNull() do
ptrTitle = fhGetItemPtr(pi,'SOUR.TITL')
strTitle = fhGetValueAsText(ptrTitle)
if string.sub(strTitle,1,20) == "Birth Certificate - " then
iCountBC = iCountBC + 1
end
pi:MoveNext()
end
fhMessageBox('Count of BC is '..iCountBC)