* Accessing named lists via plugin

For plugin authors to discuss plugin programming
Post Reply
User avatar
Mark1834
Megastar
Posts: 2405
Joined: 27 Oct 2017 19:33
Family Historian: V7
Location: South Cheshire, UK

Accessing named lists via plugin

Post by Mark1834 »

It's not clear to me how to access FH named lists via a plugin. I know they are stored in the header record, but the following code generates a listing of all header tags apart from _LIST (named list) and _ROOT (project root individual).

Code: Select all

pH = fhNewItemPtr()
p1 = fhNewItemPtr()
p2 = fhNewItemPtr()

pH:MoveToFirstRecord('HEAD')
p1:MoveToFirstChildItem(pH)

while p1:IsNotNull() do
	print(fhGetTag(p1))
	p2:MoveToFirstChildItem(p1)
	while p2:IsNotNull() do
		print(fhGetTag(p1), fhGetTag(p2))
		p2:MoveNext()
	end
	p1:MoveNext()
end
How do you access the _LIST tag (list name) and its sub-tag _IDS (list members)?

I also noticed that the tag sequence generated differs from that in the GEDCOM file, but I guess that's just a minor inconsistency in the way CP have coded it.
Mark Draper
User avatar
ColeValleyGirl
Megastar
Posts: 5379
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

Re: Accessing named lists via plugin

Post by ColeValleyGirl »

Other than the built-in functions IsInList and HasNoteInList, I'm not sure there's any support for accessing Named Lists from a plugin; you may have to parse the text file.
User avatar
tatewise
Megastar
Posts: 28126
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Accessing named lists via plugin

Post by tatewise »

Helen is correct. It is an annoying omission from the Header data references.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
Mark1834
Megastar
Posts: 2405
Joined: 27 Oct 2017 19:33
Family Historian: V7
Location: South Cheshire, UK

Re: Accessing named lists via plugin

Post by Mark1834 »

Thanks folks. In my case, I’m looping through individuals anyway to check flags, so using IsInList(…) is actually easier to code than reading the full list into a table via a proper data reference and checking against that, so that’s the way I’ll go.

It is an odd omission, though.
Mark Draper
Post Reply