Naming Citations in Preparation for RM8 #RM7 #Citations

In RM8, citations are re-useable and have a name which is made by concatenating the contents of the citation fields.
So I run this script on my RM version 7 database so that it is ready for importing into RM version 8.

I have taken advantage of this concatenation to get meaningful names by inserting a new field in my own templates as the first one in a citation and then setting the value in the citations to the source name.

This will only work for user templates, not for supplied ones (SourceTable.TemplateID > 10000)

/* update citations for RM8
 add in new field - CitItemD for citation name and put in source name - creates good citation name in RM8
UPDATE SourceTemplateTable
SET (FieldDefs) = cast(Replace(cast(FieldDefs as Text),'<Root><Fields>','<Root><Fields><Field><FieldName>CitItemD</FieldName><DisplayName>Item Name</DisplayName><Type>Text</Type><Hint>Item Name</Hint><LongHint>To distinguish citations</LongHint><CitationField>True</CitationField></Field>') as blob)
TemplateID > 10000;

-- or this could be TemplateID = a specific template number to just change one template

-- add extra field for name - at the start so it is used for citation name when converting to v8
UPDATE CitationTable 
SET (Fields) = (SELECT cast(Replace(cast(CitationTable.Fields as Text),'<Root><Fields>','<Root><Fields><Field><Name>CitItemD</Name><Value>' || SourceTable.Name ||  '</Value></Field>') as blob) 
                                FROM  SourceTable 
                                WHERE SourceTable.SourceID = CitationTable.SourceID )
    EXISTS (
       SELECT *
       FROM SourceTable 
        WHERE (SourceTable.SourceID = CitationTable.SourceID) 
AND SourceTable.TemplateID > 10000
-- or this could be TemplateID = a specific template number, to just change one template

7 Replies to “Naming Citations in Preparation for RM8 #RM7 #Citations

  1. There is or was a problem in RM7.9.320 that I have not checked for in 350 that created false merges from the new Merge Duplicate Citations function because it considered only the fields in the CitationTable, not links from potentially differing WebHints and Media. Many citations imported through TreeShare have all those fields empty and therefore equal despite having different media. Your script could preclude such false duplications because one of the fields tested by the Merge is the Citation Name. By putting the person name or other unique information into the Source name and with your script populating Citation Name with it, the merge would be precluded.

    However, I don’t think the Source Name from TreeShare is differentiated across many different citations so false merging could still be a problem. I posted this risk to feedback. The proper fix is for RM to test for differences in WebHints and Media along with the text fields of the Citation.

  2. I have been playing with the query. I have made three changes.

    I removed the parentheses from SET, viz. SET (FieldDefs) = is changed to SET FieldDefs = The version of SQLite I am using will not accept the parentheses.

    I changed TemplateID > 10000 to TemplateID >= 10000. Otherwise, my first user defined template was omitted from the query.

    I changed the string Item Name to Initial Citation Name for reasons of purely personal preference.

    So far, it all seems to work extremely well.

  3. I also broke it into two separate queries, one for the SourceTemplateTable and one for the CitationTable. It runs fine as written, but by running it as two separate files I can see the update counts for each table.

  4. I am guessing this is not reversable if I have already merged citations in RM8 and now have 4,000 odd citations with numerous hyperlinks and media attachments to different people within the one citation.


    Wayne b

    • ‘fraid not. Just another trap because development did not consider all the ramifications. I suppose it is conceivable to come up with a procedure that might convert the 4000 uses of one master citation into many master sources with few citations and uses by incorporating distinguishing data from the person, couple, facts, media… but I don’t know how useful it would be and I can only imagine it being very complex to design.

  5. Well I tried this in RM8 and added a new field to a specific source template ID. I am assuming because it is designed for RM7 in RM8 it added a Field called Item Name rather than a field called Cem in the Citation. The reason for this post is I believe this solution almost answers my Forum Question of yesterday. In my case I am trying to rename a field in the blob from for example [Cemetery] to [Cem] . I have worked out how it adds it but not how to change its name and them update each linked citation, that is the question. Updating of footnotes etc not necessary, I can edit those manually. Regards Wayne b

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.