* Custom Identifier problem
Custom Identifier problem
I think I have confused myself. I fill in the Custom ID field of the Individual Property Box every time I enter a new Individual. My last entry was for No 1250. However when I check the File Statistics (File-File Statistics in the menu) I get 1249 Individual Records. What am I doing wrong?
How do I check for a wrong/duplicate Custom ID entry - they are not numerical values so clicking on the column heading does not produce a numerical order so it therefore difficult to find a duplicate Custom ID that way. (I appreciate that Record IDs are different animals in that they are not reused if a record has been deleted so there are gaps in that list).
ID:6194
How do I check for a wrong/duplicate Custom ID entry - they are not numerical values so clicking on the column heading does not produce a numerical order so it therefore difficult to find a duplicate Custom ID that way. (I appreciate that Record IDs are different animals in that they are not reused if a record has been deleted so there are gaps in that list).
ID:6194
- tatewise
- Megastar
- Posts: 27078
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Custom Identifier problem
Change your Column expression to =TextToNumber(%INDI.REFN%) and it will sort into numerical order, which might help.
- Jane
- Site Admin
- Posts: 8441
- Joined: 01 Nov 2002 15:00
- Family Historian: V7
- Location: Somerset, England
- Contact:
Custom Identifier problem
If Mikes method does not work, if you have V5 it's possible to write a script to find the missing/duplicated ones, but we would need to know what format your keys are, are they simply numbers?
- Jane
- Site Admin
- Posts: 8441
- Joined: 01 Nov 2002 15:00
- Family Historian: V7
- Location: Somerset, England
- Contact:
Custom Identifier problem
Just to add if you just need to look for duplicates this will work
Code: Select all
--[[
@Title: Find Duplicate Custom ID's
@Author: Jane Taubman
@Version: 1.0
@LastUpdated: April 2012
@Description: Searches Selected Record Type for Records with Duplicate Custom IDs
]]
local tblId = {}
local tblDup1 = {}
local tblDup2 = {}
pi = fhNewItemPtr() -- declare pointer
pi:MoveToFirstRecord('INDI') -- and set to the first record.
while pi:IsNotNull() do
strId = fhGetItemText(pi,'~.REFN')
if strId and strId ~= '' then
if tblId[strId] then
-- Duplicate Found
table.insert(tblDup1,tblId[strId])
table.insert(tblDup2,pi:Clone())
else
tblId[strId] = pi:Clone()
end
end
pi:MoveNext()
end
if #tblDup1 > 0 then
fhOutputResultSetTitles('Individuals with Duplicate Custom Ids')
fhOutputResultSetColumn('First Record', 'item', tblDup1, #tblDup1)
fhOutputResultSetColumn('Second Record', 'item', tblDup2, #tblDup1)
else
fhMessageBox('No Duplicates Found')
end
Custom Identifier problem
Many thanks to both of you. I have run the script and there are no duplicate Custom IDs. And for good measure I have changed the column expression.
So why do the file statistics still come up with 1249 Individual records when I - definitely - have 1250! I have some very close/similar records eg in my tree George Gregor Delotz was born in 1845 but died young in 1845, so his parents tried again and had another George Gregor Delotz - in 1846. That shouldn't throw the program should it - they are entered as separate individuals.
So why do the file statistics still come up with 1249 Individual records when I - definitely - have 1250! I have some very close/similar records eg in my tree George Gregor Delotz was born in 1845 but died young in 1845, so his parents tried again and had another George Gregor Delotz - in 1846. That shouldn't throw the program should it - they are entered as separate individuals.
- tatewise
- Megastar
- Posts: 27078
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Custom Identifier problem
If FH is right and there are only 1249 Records, then perhaps you have a missing number in your Custom Id sequence that would explain why the last one is 1250.
So the script needs to be changed to look for a gap in the number sequence.
So the script needs to be changed to look for a gap in the number sequence.
Code: Select all
local tblId = {}
local intMax = 0
pi = fhNewItemPtr() -- declare pointer
pi:MoveToFirstRecord('INDI') -- and set to the first record.
while pi:IsNotNull() do
strId = fhGetItemText(pi,'~.REFN')
if strId and strId ~= '' then
local intId = tonumber(strId)
tblId[intId] = intId
if intId > intMax then intMax = intId end
end
pi:MoveNext()
end
for intId=1, intMax do
if not tblId[intId] then
fhMessageBox('Missing Custom Id='..intId)
end
end
Custom Identifier problem
Tatewise - many thanks for that edit to the script. And yes I have found no 101 missing!! All of this is not really earth shattering for my tree of course - but it is interesting academically! And very good for understanding scripts and plugins etc. So thanks folks.
- tatewise
- Megastar
- Posts: 27078
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Custom Identifier problem
Martyn,
Why do you choose to use Custom Id rather than Record Id?
You can use Tools > Work with Record Identifiers to renumber Individual Records starting from 1 at any time.
Why do you choose to use Custom Id rather than Record Id?
You can use Tools > Work with Record Identifiers to renumber Individual Records starting from 1 at any time.
Custom Identifier problem
To answer your question - not quite sure!! Force of habit probably - I need to be in control and putting a number in a box! When I export to a Gedcom file - which one gets exported? That might have a bearing if I use another FH program (heaven help me!!).
- Jane
- Site Admin
- Posts: 8441
- Joined: 01 Nov 2002 15:00
- Family Historian: V7
- Location: Somerset, England
- Contact:
Custom Identifier problem
Both will get exported, but which another program will use is anyone's guess.
- tatewise
- Megastar
- Posts: 27078
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Custom Identifier problem
Are you only 'putting a number in a box' for Individual Records?
Or are you also entering Custom Id for every other type of record - Family, Note, Source, Repository, Multimedia, etc?
These Record Id are listed in the Record Window for each type of Record.
They also appear in [square brackets] after the Title in the header of each Property Box.
Every Record type has its own unique Record Id sequence.
This is the primary key by which each Record of that type is identified in a GEDCOM file.
In my opinion this is the most likely Id that any software would use to identify Records.
You can use Tools > Work with Record Identifiers to renumber any/all of the Record Types.
If you are NOT adding Custom Id to EVERY Record Type then you are only 'putting a number in a box' for a fraction of the Records.
Why waste your time, there are better things to do.
Or are you also entering Custom Id for every other type of record - Family, Note, Source, Repository, Multimedia, etc?
These Record Id are listed in the Record Window for each type of Record.
They also appear in [square brackets] after the Title in the header of each Property Box.
Every Record type has its own unique Record Id sequence.
This is the primary key by which each Record of that type is identified in a GEDCOM file.
In my opinion this is the most likely Id that any software would use to identify Records.
You can use Tools > Work with Record Identifiers to renumber any/all of the Record Types.
If you are NOT adding Custom Id to EVERY Record Type then you are only 'putting a number in a box' for a fraction of the Records.
Why waste your time, there are better things to do.
Custom Identifier problem
Tatewise,
Many thanks for that helpful advice - it appears I am wasting my time as the Record ID does the trick. I am only inputting the Custom ID for each Individual (Record) as I wanted an unique identifier for each Individual. I will change my way of working!
I have a long way to go to understanding the details of FH (or indeed any gemealogy program) despite doing my family genealogy research for over 20 years now! You can imagine how many bits of paper I have in various files.
Many thanks for that helpful advice - it appears I am wasting my time as the Record ID does the trick. I am only inputting the Custom ID for each Individual (Record) as I wanted an unique identifier for each Individual. I will change my way of working!
I have a long way to go to understanding the details of FH (or indeed any gemealogy program) despite doing my family genealogy research for over 20 years now! You can imagine how many bits of paper I have in various files.