Logo Home    Page list

Sources - Copy Repository Name, Address from Repository List #sources #sourcetemplates #repositories

This page is in response to the request from RootsMagic Forums member JoopvB: Repositories from TMG. He asked:
Anybody an idea how to kind of copy the Repository (Info) from the address table to wherever it needs to be to be used in the source sentence? I guess I would need to create the custom fields in the source sentences? But some automated kind of copy for more than 3000 sources (yeah, I am a splitter :-) would be super.
But his problem speaks to a larger issue: some 134 built-in source templates have a Repository field but there is no mechanism to fill it in sources from the sources' Repository data.

A desirable enhancement to Source Template Language would be the addition of fields that pull data from the primary Repository for a source. This may have to function as default data unless overridden by the entry of a "local" value in the field. Unless and until such an enhancement is developed, the following scripts can help by batch populating certain empty fields with data from the Repository List. They may be especially useful to those migrating from TMG which does have such fields, [REPOSITORY] and [REPOSITORY ADDRESS]; RootsMagic 7 direct import treats them as a simple variable and imports them empty without looking up values in the TMG Master Repository List.

The first script changes the names of Repository variables to match those of the RootsMagic built-in templates. The second script populates empty Repository-type fields in Sources from values in the RootsMagic Repository List.

Two Steps

Harmonize Field Names

Source Template Field Names for Repository Information
Origin of Source Template

JoopvB TMG import
TMG Sample Project import

With other customizations either in the originating software or in a RootsMagic database, there could be a variety of other aliases that mean the same thing. Even with the built-in templates, there are some exceptions: two instances of [RepositoryCity] with [RepositorySt]; these are unhandled.
The :Abbrev modifier is also used in two instances with [RepositoryLoc] and will necessarily be ignored unless the user types in the "||" separator in the State field followed by the abbreviation for the location.

So it would seem desirable to make the custom ones consistent with the most common ones found in the built-in templates so that the script that does copying from the Repository List to the Source need only deal with one set of names and can do so for sources based on both built-in and custom source templates. This next script changes the templates and master sources to use [RepositoryLoc] instead of [RepositoryAddress] and [RepositoryInfo]. It can be readily extended to harmonize other aliases.

Copy Values from Repositories to Sources

The following script copies Repository data to the Sources based on this mapping:
Repository Name (AddressTable.Name) ==> [Repository]
Repository City and State (AddressTable.City, AddressTable.State) ==> [RepositoryLoc]
Call Number (AddressLinkTable.Details) ==> [RepositoryReference]
It currently copies only to those fields that are empty, as would be the case for a direct import from TMG. Another version could copy regardless but that would also "reset" all "local" values to "default" which may be undesirable.


Subject Author Replies Views Last Message
What fields from AddressTable? ve3meo ve3meo 12 141 Dec 16, 2014 by JoopvB JoopvB
Custom source templates, not Free Form? ve3meo ve3meo 1 68 Dec 11, 2014 by JoopvB JoopvB



Custom source templates, not Free Form?

ve3meo 11 December 2014 17:19:46

Are these sources all using custom source templates?

JoopvB 11 December 2014 22:02:39

Yes, all are custom templates in TMG.



What fields from AddressTable?

ve3meo 11 December 2014 17:26:50

What fields do you want from the AddressTable?
Can they be concatenated into a single field in the SourceTemplate? Think about what you want to see in the three sentences: Footnote, Short Footnote, Bibliography. If all are to be the same or if only one of them is to have the Repo info, then they can be concatenated into one field. But if you want a subset of the needed fields in another sentence, then there must be more than one template field. Of course, there could be template fields corresponding to the needed AddressTable fields which might be desirable for future data entry and greatest flexibility at the expense of complexity.

ve3meo 11 December 2014 19:24:47

The TMG Sample project imported to RootsMagic has custom source templates whose name begins with "_TMG_". These typically have two fields named and displayed as:
Repository and RepositoryAddress
There is another field named RepositoryReference which I presume would be specific to the source and therefore no value for it should be expected to be in the AddressTable.

There are many standard RM source templates with the two fields:
[Repository] = "Repository Name"
[RepositoryLoc] = "Repository Location"

So I think the AddressTable fields for the Repository info should be mapped to these two fields:
AddressTable.Name ==> [Repository]
AddressTable.(City, State) ==> [RepositoryAddress] (or RepositoryLoc)
That should be sufficient to identify the Repository uniquely in the footnote and/or bibliography and to facilitate its lookup in a Repository List for details. It is only when publishing that such info is needed in the footnote or bibliography because online interaction in RootsMagic provides it outside the sentence.