Page 1 of 1

Accessing named lists via plugin

Posted: 05 Jul 2023 08:52
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.

Re: Accessing named lists via plugin

Posted: 05 Jul 2023 09:10
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.

Re: Accessing named lists via plugin

Posted: 05 Jul 2023 10:27
by tatewise
Helen is correct. It is an annoying omission from the Header data references.

Re: Accessing named lists via plugin

Posted: 05 Jul 2023 10:49
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.