gedcom icon indicating copy to clipboard operation
gedcom copied to clipboard

Returning the @Identifier of a .Parents field only returns a single value, not two

Open jexp opened this issue 3 years ago • 1 comments

I'm confused when I'm looking at a .Parents or .Spouses field then returning the raw data returns everything in an odd textual format

but if I ask for the .Identifier, I get only one

./gedcom query -format csv -gedcom ~/Downloads/pres2020.ged '.Individuals | { name: .Name | .String, born: .Birth | .String, died: .Death | .String, id: .Identifier, sex:.Sex, parents:.Parents | .Identifier, parentNames:.Parents }' | head -3
born,died,id,name,parentNames,parents,sex
,,@I2184@,Paul Stobbe,[],[],Male
19 Aug 1946,,@I1@,William Jefferson Clinton,"[William Jefferson Blythe II (b. 27 Feb 1918, d. 17 May 1946) âš­ Virginia Dell Cassidy (b. 6 Jun 1923, d. Jan 1994)]",[@F2@],Male

Any ideas what I'm doing wrong?

jexp avatar Jan 18 '22 17:01 jexp

.Parents returns a slice FamilyNode. Each FamilyNode is formatted with marriage/divorce symbols between the Individuals (see https://github.com/elliotchance/gedcom/blob/v38.0.0/family_node.go#L355-L368), so it's string representation of saying "William (born in 1918) is married to Virginia (born in 1923)"

Edit: [@F2@] actually means a list with one item of @F2@. If there were two families it might look like [@F2@,@F3@].

elliotchance avatar Jan 18 '22 21:01 elliotchance