Sources+-+Copy+Repository+Name,+Address+from+Repository+List

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** || **Name** || **Location** || **Reference** ||
 * RootsMagic || [Repository] || [RepositoryLoc] ||  ||
 * JoopvB TMG import || [Repository] || [RepositoryInfo] || [RepositoryReference] ||
 * TMG Sample Project import || [Repository] || [RepositoryAddress] || [RepositoryReference] ||

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.



include component="comments" page="page:Sources - Copy Repository Name, Address from Repository List" limit="10"