Named Group Refresh #namedgroup

Intro

RootsMagic 4+ users have been seeking an improvement to Named Groups, namely “dynamic refresh” or, at least, a manual refresh button. The idea is that a group’s membership should be updated on demand following the rules that set it up in the first place. Currently, a group is static, requiring the user to edit the group, setting up the rules all over again.These sql scripts provide outboard manual refresh for specific groups.

This page collects queries designed to build membership lists for pre-named groups in RM4 databases. These queries search the subject database’s list of named groups for one whose name matches the query’s hard-coded or parameterised criteria. They delete the current members from the group and build a new set according to the programmed rules. In RM4+, selecting another group and then re-selecting the target named group updates its displayed list of members.

The queries can also include a list of persons’ Record Numbers to be unmarked from the group and a list to be marked (included) into the group. These may not be advisable for parameterised queries which use a common script as the manual inclusions and exclusions may need to be different.

For parameterised queries, SQLite Expert Personal or SQLite Developer is required. SQLiteSpy does not support run-time parameters.

Typical Usage

  1. Backup your database before you do this every time until you are confident that it does no harm.
  2. In RM4+, create a named group having the key words required by the script. Make sure first that you have no empty groups before creating a new one – there’s a bug in RM4 – and immediately add someone to your group before creating any other new ones.
  3. Open your RM4 database with SQLite Expert Personal and load the sql script into the SQL editor.
  4. Execute the query (F5)
  5. You will be prompted to enter a value for one or more “Missing parameters”, e.g., a RIN, a Year, a Place….
  6. When the query has finished, you will need to refresh the RM4 sidebar view of your group by selecting another group and then re-selecting it.

 

Named Group Scripts

NB- LabelID instead of LabelValue error corrected 2011-11-27 21:45 EST – Replace all downloaded scripts!
Ancestors Named Group: ancestors of a user-defined person, including all parental relationships
Census Needed – Named Group: persons whose lifetime probably spanned a user-defined Census Year and who had some event in the user-defined jurisdiction but not a Census fact for that year.
Named Group – Mark or Unmark List refresh: a one-button refresh of a group with arbitrary selection of persons to be marked or unmarked. Can be used after an outboard rule-based refresh on the same group (but not on any group refreshed from within RM4+).

Ranges vs Row per Person

The RM4+ GroupTable allows for group members to be defined in ranges of consecutive numbers between a StartID and EndID, thus shortening the table versus one row per member. These scripts make no attempt to use this capability so it consumes one row per member with EndID=StartID. I don’t know if there is any significant efficiency gained as a result of ranges.

Update 7 Dec 2012.
I finally figured out a way to generate the StartID-EndID ranges from a list of numbers. The query GroupTableWrite.sql listed below does the job and could be incorporated in the Named Group Scripts. Whether that is of any real advantage is even more in question now that I have examined the question a little more closely. In fact, one might argue that a table with one row per GroupID, PersonID with just one PersonID field could operate faster than the current design.

In a sample database of ~162,000 persons, ~54,000 contain the same surname string as part of the surname. Grouped into ranges, they are described by ~31,000 records in GroupTable, of which, ~23,000 are for just one person. 54,000 records is 74% more than 31,000 records but is hardly a deal-breaker – memory is cheap. Moreover, the 31,000 records store 4 values = 124,000 values while 54,000 records storing just 3 values = 162,000, only 31% more, closer to a draw on the memory front. What about the number of operations? For the current table design, there are 5 comparisons per GroupTable record for each person (PersonID >= StartID AND PersonID <=EndID) x 31,000 records X 162,000 persons = 25 billion comparisons. In the simpler concept, there is but one comparison per GroupTable record for each person (PersonID = MarkID) x 54,000 records X 162,000 persons = <9 billion comparisons. Furthermore, the single person per row structure is perfectly suited for a SQLite table index which may provide the biggest advantage as there is currently no defined index for GroupTable and it may not lend itself to SQLite’s AutoIndex.

As it turns out, writing the GroupTable with ranges is itself not majorly time-consuming, at least not for GroupTableWrite, which wrote the 31,000 records from the 54,000 record list (itself 4 subqueries of another previously defined group) in less than 5 seconds.

GroupTableWrite.sql

-- GroupTableWrite.sql
/*
2012-12-07 Tom Holden ve3meo
 
Creates StartID-EndID ranges for use in GroupTable from
a list of Marked PersonIDs and
Writes records to GroupTable
 
Replace marklist with the desired list, however generated, in
the form 1,3,479,480,481,...
 
In the Update GroupTable section,
replace the GroupID value with the one desired.
 
*/
 
DROP TABLE IF EXISTS tmpStartIDTable;
DROP TABLE IF EXISTS tmpEndIDTable;
CREATE TEMP TABLE tmpStartIDTable
AS
 
 SELECT PersonID AS StartID
 FROM PersonTable
 WHERE
 StartID IN
 (
-- marklist
SELECT PersonID FROM PersonTable, GroupTable
WHERE GroupID = 2
AND PersonID BETWEEN StartID AND EndID
  )
 AND
 StartID -1 NOT IN
 (
-- marklist
SELECT PersonID FROM PersonTable, GroupTable
WHERE GroupID = 2
AND PersonID BETWEEN StartID AND EndID
  )
 
;
 
CREATE TEMP TABLE tmpEndIDTable
AS
 
 SELECT PersonID AS EndID
 FROM PersonTable
 WHERE
 EndID IN
 (
-- marklist
SELECT PersonID FROM PersonTable, GroupTable
WHERE GroupID = 2
AND PersonID BETWEEN StartID AND EndID
  )
 AND
 EndID +1 NOT IN
 (
-- marklist
SELECT PersonID FROM PersonTable, GroupTable
WHERE GroupID = 2
AND PersonID BETWEEN StartID AND EndID
  )
 
;
 
-- Update GroupTable
-- change GroupID value to match LabelValue for group from LabelTable
DELETE FROM GroupTable WHERE GroupID = 3
;
 
INSERT INTO GroupTable
SELECT NULL AS RecID, 3 AS GroupID, * FROM tmpStartIDTable StartID INNER JOIN tmpEndIDTable EndID
ON StartID.rowid = EndID.rowid
;

Backup Media with Database – RAR #batch #backup #media #rar

(See Backup Media with Database – 7Zip for a similar procedure using 7-zip.)

Here is a one-click backup procedure that stores the database file and all the media files it references in one solid, compressed backup file, preserving the path to each. Many have lamented the fact that RootsMagic 4 neither stores images in its database file nor backs up media files together with the database file so that all the files can be transported together between drives, computers, cloud storage, etc. A workaround is to follow the procedure Create a Shareable CD and zip the collected files found in its temporary folder prior to burning the CD but this has proven cumbersome, slow, the folder hierachy is collapsed and multiple links to the same media file result in as many copies.

The Zip encoder RM4-7 uses for Backup may not be able to handle a large database with many media files – another reason to use outboard procedures until its limitations are lifted. See this article in Wikipedia on the early Zip limits.

This procedure is based on a very simple query that lists the paths and names of all the media files referenced by the database:

SELECT DISTINCT MediaPath || MediaFile FROM MultiMediaTable;

The following command line procedure or batch file runs the command line version of SQLite3, opening the RootsMagic database whose name is passed in the call to the procedure and executes the query. The resulting list of media files is passed via STDIN to RAR which creates or updates the backup file. When RAR finishes the list from sqlite, it sees the database filename and processes it, too. The resulting .rar file can be opened by WinRAR and a variety of other archiving utilities. The procedure could be revised to use a different archiver.

ECHO OFF
REM RMfullbackup.bat
REM by Tom Holden 2011-02-02
REM Backs up a RootsMagic database file and all the media files referenced by it to one, compressed RAR file.
REM
REM Command syntax: RMfullbackup.bat <databasename>
REM Close the database file before running.
REM
REM The first backup can take considerable time, depending on the total of the file sizes.
REM To save time on subsequent backups, RMfullbackup merely updates the backup file for those files added, changed or deleted.
REM Install the SQLite3 command line version in the same directory as the RMGC database file(s)
REM  OR set a system PATH to where sqlite3.exe is located
REM  OR prepend the path to sqlite3.exe in the command below.
REM Likewise for RAR.exe
REM Under the RM Data folder, create a folder Backups; if a different path is to be used, edit the command line below.
REM
REM The backup file will be written to the Backups folder and will have the name <databasename>_fullbackup.rar
REM An error log will also be written to the Backups folder with the name <databasename>_fullbackuperror.log
REM
REM backup media files listed by query followed by the database file
 
sqlite3.exe %1.rmgc "SELECT DISTINCT MediaPath || MediaFile from MultiMediaTable;" | rar a -u -as -ilog.backups%1_fullbackuperror.log backups%1_fullbackup @ %1.rmgc
PAUSE
END

Download and save in the folder where you have your RootsMagic databases:
RMfullbackup.bat.bak (.bak added due some systems’ security. Remove after d/l)

Create a shortcut to RMfullbackup.bat <databasename> and name and place it where it is convenient. Do not include “.rmgc” in the database name. Make as many of these shortcuts as there are different databases to be backed up.

Clicking on the shortcut will launch a command window where you will see RAR working through the list. When it is finished the window will stay open until you press a key, allowing an opportunity for you to inspect the messages. Error messages from RAR are stored in the error log for later review. Note that the RM database must be closed in order for the database file to be processed by RAR.

Utilities by R. Steven Turley #application

This page gathers links to the RootsMagic utilities developed by R. Steven Turley.

2012-11-08 Copying Custom Reports copies a custom report from one database to another.

2012-11-08 Source Template Maintenance

  • list all of the sources using a particular template
  • find a template containing certain phrases
  • list those custom templates I have created
  • list the templates I am actually using in my sources

2012-10-04 AltMarried checks GEDCOM for the existence of an Alternate Name (Married) fact for each wife.

2012-01-03 SplitTree (AKA RMsplit) creates and maintains a Named Group

Role Types #datadefinitions #roles

RootsMagic 4+ Built-In Roles

The built-in roles for RM4 and later can be found in RoleTable with RoleID up through 58. User-defined/custom types are assigned values of 59 and higher by the program when created.

Built-in roles and their unedited values within the table are as follows:

RoleID RoleName EventType RoleType Sentence
1 Witness 1 0 [ThisPerson] witnessed the birth of [person]< [Date]>< [PlaceDetails]>< [Place]>.
2 Doctor 1 0 [ThisPerson] delivered [person]< [Date]>< [PlaceDetails]>< [Place]>.
3 Witness 2 0 [ThisPerson] witnessed the death of [person]< [Date]>< [PlaceDetails]>< [Place]>.
4 Witness 3 0 [ThisPerson] witnessed the christening of [person]< [Date]>< [PlaceDetails]>< [Place]>.
5 Witness 4 0 [ThisPerson] witnessed the burial of [person]< [Date]>< [PlaceDetails]>< [Place]>.
6 Witness 5 0 [ThisPerson] witnessed the cremation of [person]< [Date]>< [PlaceDetails]>< [Place]>.
7 Witness 6 0 [ThisPerson] witnessed the adoption of [person]< [Date]>< [PlaceDetails]>< [Place]>.
8 Witness 7 0 [ThisPerson] witnessed the baptism of [person]< [Date]>< [PlaceDetails]>< [Place]>.
9 Witness 8 0 [ThisPerson] witnessed the bar mitzvah of [person]< [Date]>< [PlaceDetails]>< [Place]>.
10 Witness 9 0 [ThisPerson] witnessed the bas mitzvah of [person]< [Date]>< [PlaceDetails]>< [Place]>.
11 Witness 10 0 [ThisPerson] witnessed the blessing of [person]< [Date]>< [PlaceDetails]>< [Place]>.
12 Witness 11 0 [ThisPerson] witnessed the christening of [person]< [Date]>< [PlaceDetails]>< [Place]>.
13 Witness 12 0 [ThisPerson] witnessed the confirmation of [person]< [Date]>< [PlaceDetails]>< [Place]>.
14 Witness 13 0 [ThisPerson] witnessed the first communion of [person]< [Date]>< [PlaceDetails]>< [Place]>.
15 Witness 14 0 [ThisPerson] witnessed the ordaination of [person]< [Date]>< [PlaceDetails]>< [Place]>.
16 Witness 15 0 [ThisPerson] witnessed the naturalization of [person]< [Date]>< [PlaceDetails]>< [Place]>.
17 Witness 16 0 [ThisPerson] witnessed the emigration of [person]< [Date]>< [PlaceDetails]>< [Place]>.
18 Witness 17 0 [ThisPerson] witnessed the immigration of [person]< [Date]>< [PlaceDetails]>< [Place]>.
19 Witness 18 0 [ThisPerson] appeared in the household of [person] in the census< [Date]>< [PlaceDetails]>< [Place]>.
20 Witness 19 0 [ThisPerson] witnessed the probate of [person]< [Date]>< [PlaceDetails]>< [Place]>.
21 Witness 20 0 [ThisPerson] witnessed the will of [person]< [Date]>< [PlaceDetails]>< [Place]>.
22 Heir 20 0 [ThisPerson] was named an heir in the will of [person]< [Date]>< [PlaceDetails]>< [Place]>.
23 Executor 20 0 [ThisPerson] was named an executor for the will of [person]< [Date]>< [PlaceDetails]>< [Place]>.
24 Witness 21 0 [ThisPerson] witnessed the graduation of [person]< [Date]>< [PlaceDetails]>< [Place]>.
25 Witness 22 0 [ThisPerson] witnessed the retirement of [person]< [Date]>< [PlaceDetails]>< [Place]>.
26 Witness 23 0 [ThisPerson] witnessed the appearance of [person] as [Desc]< [Date]>< [PlaceDetails]>< [Place]>.
27 Witness 24 0 [ThisPerson] witnessed the education of [person]< [Date]>< [PlaceDetails]>< [Place]>.
28 Witness 25 0 [ThisPerson] witnessed the nationality of [person] as [Desc]< [Date]>< [PlaceDetails]>< [Place]>.
29 Witness 26 0 [ThisPerson] witnessed the occupation of [person]< [Date]> as [Desc:A]< [PlaceDetails]>< [Place]>.
30 Witness 27 0 [ThisPerson] witnessed the property of [person] as [Desc:A]< [Date]>< [PlaceDetails]>< [Place]>.
31 Witness 28 0 [ThisPerson] witnessed the religion of [person] as [Desc:A]< [Date]>< [PlaceDetails]>< [Place]>.
32 Witness 29 0 [ThisPerson] lived in the residence of [person] < [PlaceDetails]>< [Place]>< [Date]>.
33 Witness 31 0 [ThisPerson] witnessed the baptism of [person] into the LDS Church< [Date]>< [PlaceDetails]>< [Place]>.
34 Witness 32 0 [ThisPerson] witnessed the endowment of [person]< [Date]>< [PlaceDetails]>< [Place]>.
35 Witness 33 0 [ThisPerson] witnessed the sealed to parents of [person]< [Date]>< [PlaceDetails]>< [Place]>.
36 Witness 36 0 [ThisPerson] witnessed the associated with [Desc] of [person]< [Date]>< [PlaceDetails]>< [Place]>.
37 Witness 38 0 [ThisPerson] witnessed the comfirmation of [person] as a member of the LDS Church< [Date]>< [PlaceDetails]>< [Place]>.
38 Witness 39 0 [ThisPerson] witnessed the LDS initiatory of [person]< [Date]>< [PlaceDetails]>< [Place]>.
39 Witness 300 0 [ThisPerson] witnessed the marriage of [couple]< [Date]>< [PlaceDetails]>< [Place]>.
40 Witness 301 0 [ThisPerson] witnessed the annullment of the marriage of [couple]< [Date]>< [PlaceDetails]>< [Place]>.
41 Witness 302 0 [ThisPerson] witnessed the divorce of [couple]< [Date]>< [PlaceDetails]>< [Place]>.
42 Witness 303 0 [ThisPerson] witnessed the divorce filing of [couple]< [Date]>< [PlaceDetails]>< [Place]>.
43 Witness 304 0 [ThisPerson] witnessed the engagement of [couple]< [Date]>< [PlaceDetails]>< [Place]>.
44 Witness 305 0 [ThisPerson] witnessed the publishing of the marriage banns of [couple]<[Date]>< [PlaceDetails]>< [Place]>.
45 Witness 306 0 [ThisPerson] witnessed the marriage contract of [couple]< [Date]>< [PlaceDetails]>< [Place]>.
46 Witness 307 0 [ThisPerson] witnessed the obtaining of the marriage license by [couple]< [Date]>< [PlaceDetails]>< [Place]>.
47 Witness 308 0 [ThisPerson] witnessed the marriage settlement of [couple]< [Date]>< [PlaceDetails]>< [Place]>.
48 Witness 309 0 [ThisPerson] witnessed the sealing of [couple]< [Date]>< [PlaceDetails]>< [Place]>.
49 Witness 311 0 [ThisPerson] appeared in the census in the household of [couple]< [Date]>< [PlaceDetails]>< [Place]>.
50 Witness 500 0 [ThisPerson] witnessed the degree of [person]< [Date]>< [PlaceDetails]>< [Place]>.
51 Witness 501 0 [ThisPerson] witnessed the military service of [person]< [Date]>< [PlaceDetails]>< [Place]>.
52 Witness 502 0 [ThisPerson] witnessed the mission of [person]< [Date]>< [PlaceDetails]>< [Place]>.
53 Witness 503 0 [ThisPerson] witnessed the stillbirth of [person]< [Date]>< [PlaceDetails]>< [Place]>.
54 Witness 504 0 [ThisPerson] witnessed the illness of [person] with [Desc]< [Date]>< [PlaceDetails]>< [Place]>.
55 Witness 507 0 [ThisPerson] witnessed the election of [person] as [Desc]< [Date]>< [PlaceDetails]>< [Place]>.
56 Witness 508 0 [ThisPerson] witnessed the excommunication of [person]< [Date]>< [PlaceDetails]>< [Place]>.
57 Witness 510 0 [ThisPerson] witnessed the separation of [couple]< [Date]>< [PlaceDetails]>< [Place]>.
58 Witness 999 0 [person]< [Desc]>< [Date]>< [PlaceDetails]>< [Place]>.

Fact Types #datadefinitions #facttypes

RootsMagic 4+ Built-In Fact Types

2023-05-22 updated to RM9

The built-in fact types for RM4 and later can be found in the FactTypeTable with FactTypeID less than 1000. User-defined/custom types are assigned values of 1000 and higher by the program when created. Between RM4 and RM9, only the 902-Associations fact type has been added. There may have been changes in Sentence templates and Flags (latter might be related to 32-bit vs 64-bit numbers). And the UTCModDate column has been added.

Following is a summary of the RM9 Built-in fact types in order of FactTypeID. note the clustering of “vital” facts (1-5 or 6 et al scattered), religious facts (7-14 except 28-Religion), citizenship (15-18 plus others), “family” (300 series except 510-Separation), unconventionals (90x series). These clusters may be a holdover from some early concept for sequencing the listing of events in other than chronological order. And the invisible-to-the-user FactTypeID appears to be the primary sort key in RM9 when the Edit Person option “Sort facts by” > “Fact type” is chosen – a seemingly odd result when intuitively one expects an alphabetical sort by fact Name.

FactTypeIDOwnerTypeFactNameAbbrevGedcomTagRM4ID
10BirthBirthBIRT1
20DeathDeathDEAT2
30ChristenChrCHR3
40BurialBurialBURI4
50CremationCremationCREM5
60AdoptionAdoptionADOP6
70BaptismBaptismBAPM7
80Bar MitzvahBar MitzvahBARM8
90Bas MitzvahBas MitzvahBASM9
100BlessingBlessingBLES10
110Christen (adult)Chr (adult)CHRA11
120ConfirmationConfirmationCONF12
130First communionFirst commFCOM13
140OrdinationOrdinationORDN14
150NaturalizationNaturalizationNATU15
160EmigrationEmigrationEMIG16
170ImmigrationImmigrationIMMI17
180CensusCensusCENS18
190ProbateProbatePROB19
200WillWillWILL20
210GraduationGraduationGRAD21
220RetirementRetirementRETI22
230DescriptionDescriptionDSCR23
240EducationEducationEDUC24
250NationalityNationalityNATI25
260OccupationOccupationOCCU26
270PropertyPropertyPROP27
280ReligionReligionRELI28
290ResidenceResidenceRESI29
300Soc Sec NoSSNSSN30
310LDS BaptismLDS BaptBAPL31
320LDS EndowmentLDS EndowENDL32
330LDS Seal to parentsLDS SealParSLGC33
340Ancestral File NumberAFNAFN34
350Reference NoRef #REFN35
360CasteCasteCAST36
370Title (Nobility)TitleTITL37
380LDS ConfirmationLDS ConfCONL38
390LDS InitiatoryLDS InitWAC39
3001MarriageMarriageMARR300
3011AnnulmentAnnulmentANUL301
3021DivorceDivorceDIV302
3031Divorce filedDiv. filedDIVF303
3041EngagementEngagementENGA304
3051Marriage BannMarr BannMARB305
3061Marriage ContractMarr ContractMARC306
3071Marriage LicenseMarr LicMARL307
3081Marriage SettlementMarr SettlementMARS308
3091LDS Seal to spouseLDS SealSpSLGS309
3101Residence (family)Residence (fam)RESI310
3111Census (family)Census (fam)CENS311
5000DegreeDegreeEVEN500
5010MilitaryMilitaryEVEN501
5020MissionMissionEVEN502
5030StillbornStillbornEVEN503
5040IllnessIllnessEVEN504
5050LivingLivingEVEN505
5070ElectionElectedEVEN507
5080ExcommunicationExcommEVEN508
5090NamesakeNamesakeEVEN509
5101SeparationSeparationEVEN510
9000Alternate nameAlt. NameEVEN900
9010DNA testDNA_DNA901
9020AssociationAssociationEVEN
9990MiscellaneousMiscEVEN999

RM6 Database System Catalog #database #datadefinitions

A singular system table, sqlite_master, resides in a SQLite database. This table in the RootsMagic 6 database essentially defines the RootsMagic 6 database tables, indices, and fields, as below.

The difference in structure with RootsMagic 5 is the addition of one new table, URLTable (no index) for WebTags.

 

type name tbl_name rootpage sql
table AddressLinkTable AddressLinkTable 21 CREATE TABLE AddressLinkTable (LinkID INTEGER PRIMARY KEY, OwnerType INTEGER, AddressID INTEGER, OwnerID INTEGER, AddressNum INTEGER, Details TEXT )
table AddressTable AddressTable 9 CREATE TABLE AddressTable (AddressID INTEGER PRIMARY KEY, AddressType INTEGER, Name TEXT COLLATE RMNOCASE, Street1 TEXT, Street2 TEXT, City TEXT, State TEXT, Zip TEXT, Country TEXT, Phone1 TEXT, Phone2 TEXT, Fax TEXT, Email TEXT, URL TEXT, Latitude INTEGER, Longitude INTEGER, Note BLOB )
index idxAddressName AddressTable 42 CREATE INDEX idxAddressName ON AddressTable (Name)
table ChildTable ChildTable 5 CREATE TABLE ChildTable (RecID INTEGER PRIMARY KEY, ChildID INTEGER, FamilyID INTEGER, RelFather INTEGER, RelMother INTEGER, ChildOrder INTEGER, IsPrivate INTEGER, ProofFather INTEGER, ProofMother INTEGER, Note BLOB )
index idxChildID ChildTable 37 CREATE INDEX idxChildID ON ChildTable (ChildID)
index idxChildFamilyID ChildTable 38 CREATE INDEX idxChildFamilyID ON ChildTable (FamilyID)
index idxChildOrder ChildTable 39 CREATE INDEX idxChildOrder ON ChildTable (ChildOrder)
table CitationTable CitationTable 20 CREATE TABLE CitationTable (CitationID INTEGER PRIMARY KEY, OwnerType INTEGER, SourceID INTEGER, OwnerID INTEGER, Quality TEXT, IsPrivate INTEGER, Comments BLOB, ActualText BLOB, RefNumber TEXT, Flags INTEGER, Fields BLOB )
index idxCitationSourceID CitationTable 62 CREATE INDEX idxCitationSourceID ON CitationTable (SourceID)
index idxCitationOwnerID CitationTable 63 CREATE INDEX idxCitationOwnerID ON CitationTable (OwnerID)
table ConfigTable ConfigTable 2 CREATE TABLE ConfigTable (RecID INTEGER PRIMARY KEY, RecType INTEGER, Title TEXT, DataRec BLOB )
index idxRecType ConfigTable 34 CREATE INDEX idxRecType ON ConfigTable (RecType)
table EventTable EventTable 7 CREATE TABLE EventTable (EventID INTEGER PRIMARY KEY, EventType INTEGER, OwnerType INTEGER, OwnerID INTEGER, FamilyID INTEGER, PlaceID INTEGER, SiteID INTEGER, Date TEXT, SortDate INTEGER, IsPrimary INTEGER, IsPrivate INTEGER, Proof INTEGER, Status INTEGER, EditDate FLOAT, Sentence BLOB, Details BLOB, Note BLOB )
index idxOwnerEvent EventTable 40 CREATE INDEX idxOwnerEvent ON EventTable (OwnerID,EventType)
index idxOwnerDate EventTable 41 CREATE INDEX idxOwnerDate ON EventTable (OwnerID,SortDate)
table ExclusionTable ExclusionTable 28 CREATE TABLE ExclusionTable (RecID INTEGER PRIMARY KEY, ExclusionType INTEGER, ID1 INTEGER, ID2 INTEGER )
index idxExclusionIndex ExclusionTable 73 CREATE UNIQUE INDEX idxExclusionIndex ON ExclusionTable (ExclusionType, ID1, ID2)
table FactTypeTable FactTypeTable 10 CREATE TABLE FactTypeTable (FactTypeID INTEGER PRIMARY KEY, OwnerType INTEGER, Name TEXT COLLATE RMNOCASE, Abbrev TEXT, GedcomTag TEXT, UseValue INTEGER, UseDate INTEGER, UsePlace INTEGER, Sentence BLOB, Flags INTEGER )
index idxFactTypeName FactTypeTable 43 CREATE INDEX idxFactTypeName ON FactTypeTable (Name)
index idxFactTypeAbbrev FactTypeTable 45 CREATE INDEX idxFactTypeAbbrev ON FactTypeTable (Abbrev)
index idxFactTypeGedcomTag FactTypeTable 46 CREATE INDEX idxFactTypeGedcomTag ON FactTypeTable (GedcomTag)
table FamilyTable FamilyTable 4 CREATE TABLE FamilyTable (FamilyID INTEGER PRIMARY KEY, FatherID INTEGER, MotherID INTEGER, ChildID INTEGER, HusbOrder INTEGER, WifeOrder INTEGER, IsPrivate INTEGER, Proof INTEGER, SpouseLabel INTEGER, FatherLabel INTEGER, MotherLabel INTEGER, Note BLOB )
index idxFamilyFatherID FamilyTable 35 CREATE INDEX idxFamilyFatherID ON FamilyTable (FatherID)
index idxFamilyMotherID FamilyTable 36 CREATE INDEX idxFamilyMotherID ON FamilyTable (MotherID)
table GroupTable GroupTable 26 CREATE TABLE GroupTable (RecID INTEGER PRIMARY KEY, GroupID INTEGER, StartID INTEGER, EndID INTEGER )
table LabelTable LabelTable 30 CREATE TABLE LabelTable (LabelID INTEGER PRIMARY KEY, LabelType INTEGER, LabelValue INTEGER, LabelName TEXT COLLATE RMNOCASE, Description TEXT )
index idxLabelType LabelTable 71 CREATE INDEX idxLabelType ON LabelTable (LabelType)
table LinkTable LinkTable 24 CREATE TABLE LinkTable (LinkID INTEGER PRIMARY KEY, extSystem INTEGER, LinkType INTEGER, rmID INTEGER, extID TEXT, Modified INTEGER, extVersion TEXT, extDate FLOAT, Status INTEGER, Note BLOB )
index idxLinkRmId LinkTable 67 CREATE INDEX idxLinkRmId ON LinkTable (rmID)
index idxLinkExtId LinkTable 68 CREATE INDEX idxLinkExtId ON LinkTable (extID)
table MediaLinkTable MediaLinkTable 13 CREATE TABLE MediaLinkTable (LinkID INTEGER PRIMARY KEY, MediaID INTEGER, OwnerType INTEGER, OwnerID INTEGER, IsPrimary INTEGER, Include1 INTEGER, Include2 INTEGER, Include3 INTEGER, Include4 INTEGER, SortOrder INTEGER, RectLeft INTEGER, RectTop INTEGER, RectRight INTEGER, RectBottom INTEGER, Note TEXT, Caption TEXT COLLATE RMNOCASE, RefNumber TEXT COLLATE RMNOCASE, Date TEXT, SortDate INTEGER, Description BLOB )
index idxMediaOwnerID MediaLinkTable 49 CREATE INDEX idxMediaOwnerID ON MediaLinkTable (OwnerID)
index idxMediaCaption MediaLinkTable 50 CREATE INDEX idxMediaCaption ON MediaLinkTable (Caption)
table MultimediaTable MultimediaTable 11 CREATE TABLE MultimediaTable (MediaID INTEGER PRIMARY KEY, MediaType INTEGER, MediaPath TEXT, MediaFile TEXT COLLATE RMNOCASE, URL TEXT, Thumbnail BLOB , Caption TEXT COLLATE RMNOCASE, RefNumber TEXT COLLATE RMNOCASE, Date TEXT, SortDate INTEGER, Description BLOB)
index idxMediaFile MultimediaTable 47 CREATE INDEX idxMediaFile ON MultimediaTable (MediaFile)
index idxMediaURL MultimediaTable 48 CREATE INDEX idxMediaURL ON MultimediaTable (URL)
table NameTable NameTable 14 CREATE TABLE NameTable (NameID INTEGER PRIMARY KEY, OwnerID INTEGER, Surname TEXT COLLATE RMNOCASE, Given TEXT COLLATE RMNOCASE, Prefix TEXT COLLATE RMNOCASE, Suffix TEXT COLLATE RMNOCASE, Nickname TEXT COLLATE RMNOCASE, NameType INTEGER, Date TEXT, SortDate INTEGER, IsPrimary INTEGER, IsPrivate INTEGER, Proof INTEGER, EditDate FLOAT, Sentence BLOB, Note BLOB, BirthYear INTEGER, DeathYear INTEGER )
index idxNameOwnerID NameTable 51 CREATE INDEX idxNameOwnerID ON NameTable (OwnerID)
index idxSurname NameTable 52 CREATE INDEX idxSurname ON NameTable (Surname)
index idxGiven NameTable 53 CREATE INDEX idxGiven ON NameTable (Given)
index idxSurnameGiven NameTable 54 CREATE INDEX idxSurnameGiven ON NameTable (Surname, Given, BirthYear, DeathYear)
index idxNamePrimary NameTable 56 CREATE INDEX idxNamePrimary ON NameTable (IsPrimary)
table PersonTable PersonTable 3 CREATE TABLE PersonTable (PersonID INTEGER PRIMARY KEY, UniqueID TEXT, Sex INTEGER, EditDate FLOAT, ParentID INTEGER, SpouseID INTEGER, Color INTEGER, Relate1 INTEGER, Relate2 INTEGER, Flags INTEGER, Living INTEGER, IsPrivate INTEGER, Proof INTEGER, Bookmark INTEGER, Note BLOB )
table PlaceTable PlaceTable 16 CREATE TABLE PlaceTable (PlaceID INTEGER PRIMARY KEY, PlaceType INTEGER, Name TEXT COLLATE RMNOCASE, Abbrev TEXT, Normalized TEXT, Latitude INTEGER, Longitude INTEGER, LatLongExact INTEGER, MasterID INTEGER, Note BLOB )
index idxPlaceName PlaceTable 57 CREATE INDEX idxPlaceName ON PlaceTable (Name)
index idxPlaceAbbrev PlaceTable 58 CREATE INDEX idxPlaceAbbrev ON PlaceTable (Abbrev)
table ResearchItemTable ResearchItemTable 31 CREATE TABLE ResearchItemTable (ItemID INTEGER PRIMARY KEY, LogID INTEGER, Date TEXT, SortDate INTEGER, RefNumber TEXT, Repository TEXT, Goal TEXT, Source TEXT, Result TEXT )
index idxResearchItemLogID ResearchItemTable 72 CREATE INDEX idxResearchItemLogID ON ResearchItemTable (LogID)
table ResearchTable ResearchTable 17 CREATE TABLE ResearchTable (TaskID INTEGER PRIMARY KEY, TaskType INTEGER, OwnerID INTEGER, OwnerType INTEGER, RefNumber TEXT, Name TEXT COLLATE RMNOCASE, Status INTEGER, Priority INTEGER, Date1 TEXT, Date2 TEXT, Date3 TEXT, SortDate1 INTEGER, SortDate2 INTEGER, SortDate3 INTEGER, Filename TEXT, Details BLOB )
index idxResearchOwnerID ResearchTable 59 CREATE INDEX idxResearchOwnerID ON ResearchTable (OwnerID)
index idxResearchName ResearchTable 60 CREATE INDEX idxResearchName ON ResearchTable (Name)
table RoleTable RoleTable 25 CREATE TABLE RoleTable (RoleID INTEGER PRIMARY KEY, RoleName TEXT COLLATE RMNOCASE, EventType INTEGER, RoleType INTEGER, Sentence TEXT )
index idxRoleEventType RoleTable 69 CREATE INDEX idxRoleEventType ON RoleTable (EventType)
table SourceTable SourceTable 19 CREATE TABLE SourceTable (SourceID INTEGER PRIMARY KEY, Name TEXT COLLATE RMNOCASE, RefNumber TEXT, ActualText TEXT, Comments TEXT, IsPrivate INTEGER, TemplateID INTEGER, Fields BLOB )
index idxSourceName SourceTable 61 CREATE INDEX idxSourceName ON SourceTable (Name)
table SourceTemplateTable SourceTemplateTable 29 CREATE TABLE SourceTemplateTable (TemplateID INTEGER PRIMARY KEY, Name TEXT COLLATE RMNOCASE, Description TEXT, Favorite INTEGER, Category TEXT, Footnote TEXT, ShortFootnote TEXT, Bibliography TEXT, FieldDefs BLOB )
index idxSourceTemplateName SourceTemplateTable 70 CREATE INDEX idxSourceTemplateName ON SourceTemplateTable (Name)
table URLTable URLTable 32 CREATE TABLE URLTable (LinkID INTEGER PRIMARY KEY, OwnerType INTEGER, OwnerID INTEGER, LinkType INTEGER, Name TEXT, URL TEXT, Note BLOB )
table WitnessTable WitnessTable 23 CREATE TABLE WitnessTable (WitnessID INTEGER PRIMARY KEY, EventID INTEGER, PersonID INTEGER, WitnessOrder INTEGER, Role INTEGER, Sentence TEXT, Note BLOB, Given TEXT COLLATE RMNOCASE, Surname TEXT COLLATE RMNOCASE, Prefix TEXT COLLATE RMNOCASE, Suffix TEXT COLLATE RMNOCASE )
index idxWitnessEventID WitnessTable 64 CREATE INDEX idxWitnessEventID ON WitnessTable (EventID)
index idxWitnessPersonID WitnessTable 65 CREATE INDEX idxWitnessPersonID ON WitnessTable (PersonID)

Wish List

Post your wishes for utilities that will help you with your RootsMagic
projects by posting under Discussion (tiny button up there with two bubbles
next to Edit), with a new topic for each unique wish. Someone will summarize
them on this page.

Group Discussion or Page Status
Media Insert Image Metadata into database see Media Metadata, Read, Write, Compare with Picasa
People Add
Married Name as Alternate Name
see Names – Add Married
People Bulk delete see Delete Many
Facts Set Sort Dates to Natural Order see Dates
– Same Day Sort Order
Facts Convert Shared Facts to Individual Facts see Facts – Split Shared to Individual
Facts Merge
Duplicate Facts
see Events – Merge

Discussions & comments
from Wikispaces site

Insert Image
Metadata into database

LessTX 14 January 2012 20:56:51

 

This is on the RM enhancement list, but there’s no reason to
not do it now.
Some of us, hopefully many of us, use IPTC or XMP metadata to
identify photographs and scanned jpg or tif documents. In that
way the information about the image is a part of the image
file, rather than in some external file that can get unlinked.
This data could be imported into the Caption, Description, and
date fields of the media item, thus eliminating the need to
re-enter it or leave it blank.
Would also be nice to have the ability to “refresh” the RM
database from the current image file metadata.
The following equivalencies exist between the metadata fields
and RM database:
IPTCHeadline===photoshop:Headline===RMCaption
IPTCCaption/Abstract===dc:description===RMDescription
IPTCDateCreated===photoshop:DateCreated===RMDate

ve3meo 14 January 2012 22:47:12

Great idea! I caption my photos in Picasaweb. It would be
great to have some kind of comparison and merge
functionality, in addition to a straight copy.
Any ideas on tools? I found this:
https://www.sno.phy.queensu.ca/~phil/exiftool/
looks really powerful, free, but written in Perl.

Individual Names

LessTX 18 January 2012 15:29:05

Copying some ideas from the TMG Utilities…

One of the most frequently used things from TMG Utilities was
the ability to create Married Names for all the women in the
database, automatically.
Yes, you’d really only do it once, or after adding a whole lot
of people, but it was a huge time saver. Later he added
capability to add and change all different types of names, for
v1.0 I’d say just do the married name thing
You’d choose the alternate name type (Married) and if you
wanted to put in a date or just a sort date, make it the same
as the marriage date (or one day after for the sort date). Do
you want to put the maiden name in parentheses in the suffix
field?
Then it goes and adds a married name for every female, for
every marriage, if one does not already exist.
The checks for “does it exist” would be if the surname is the
same as the spouse’s name.
Also another “tag date” or “tag sort” utility would fix the
dates, so that married names that already existed would get
the date of the marriage, or you could set sort dates for the
day after the marriage – those would work on already existing
marriages.
This would be an exceedingly useful thing.

ve3meo 01 December 2012 13:09:20

The query has been developed – see Names – Add Married.


Set Sort Dates

LessTX 18 January 2012 15:32:46
Another of the exceedingly popular things from the TMG Utility
was the ability to quickly and globally set sort dates for all
of the tags.
You could arrange the list of tags, so that existing and
undated tags would be given sort dates that put them in the
requested order to make viewing of the person’s timeline a lot
less chaotic.
It was database wide, and only modified events with no sort
date, but could force burial after marriage, names after
birth, etc. You can look at the TMG Utility web page for
description of how it worked.

ve3meo 19 January 2012 20:10:19

Have you looked at Dates – Same Day Sort Order? Does it appear to answer some
or all of wish?


Merge duplicate facts

mfseeker 24 January 2012 02:25:17
More often than is comfortable, records end up with duplicate
facts that are distinguished only by one having a note or
source that the other lacks. It would be helpful if we had a
utility that would locate such “duplicate facts”, merge their
notes and/or sources, and delete the duplicate. At the very
least, it would help if we had a utility that would delete any
duplicate fact that had no notes or sources or, perhaps, no
new notes or sources.

Global convert fact type

PJEvans1 13 February 2012 00:39:53

I think it’s a good idea.
The other fact-manipulation tool I’d like is one to convert
fact types at the global level. (Ancestry seems to put
everything into ‘Residence’ that isn’t birth, death, or
marriage.


ve3meo 14 February 2012 02:33:30
@PJEvans1: How would you see this working?
1. Convert all facts of one type to another?
OR
2. Convert a filtered subset of facts of one type to another?

Bulk delete

snowathlete 24 October 2012 12:48:23
So frustrating to find there is no bulk delete capabily, and
that the rootsmagician has no plans to provide one.
id like to be able to delete whole trees, or branches,
ancestors, descendants of an individual (with collatoral
lines) and delete the members of a named group, or those with
color coding. Even delete based on other data fields.

ve3meo 28 October 2012 03:16:51

Have a look at Delete Many. It answers the request to delete the members of
a named group, or those with color coding. You can use the
full capabilities of RootsMagic Explorer to create Named
Groups or coloured sets based on other data fields.
Alternatively, you could use other custom SQLite queries to
set a colour code or group.

People View Error – at most 64 tables in a Join #error #config

Problem

In a discussion on the RootsMagic Forums, maginnis reported a problem with People View. After customising to add Place and Place Detail for many fact types, People View repeatedly threw up the error message “SQLite Error 1 – at most 64 tables in a join” until RootsMagic closed. The same error cropped up when People View was selected after re-opening the database. SQLite does have a limit of 64 tables being simultaneously joined, increased from 32 in 2007. It appears that the way RootsMagic builds the SQLite query to populate the People View is to join one or more tables for each column and does not limit the total to 64 or less, hence the error.

This error has no effect on the database and RootsMagic can continue to be used in every other way after reopening; only the People View is unusable.

How to Restore People View?

GEDCOM export and Drag & Drop are unaffected so one way is to use either method to transfer the data to a new database. That may be satisfactory to many users but not to some. We know that those transfers are not perfectly transparent yet may be good enough. Trailing white space in Notes is truncated on transfer for certain. We do not know if there are any other losses (provided all Fact Types used are set to be included in GEDCOM) other than unused items such as custom source templates, custom fact types, roles, places and place details, media, et al. RMtrix contains utilities (also available as SQLite queries) to add Carriage Return/Line Feed to the end of Notes and to review and set Fact Types to GEDCOM (which also governs D&D).

Another way is to dive into the database to reduce the number of columns to be included in People View. This technique is sure to have no effect on the data and is what is described here.

People View Settings

The column definitions for People View are stored in the first record of ConfigTable in the DataRec column. DataRec is a BLOB (binary) type containing XML text so we have to CAST it to TEXT type to view and CAST modified text to BLOB type to save.

-- Inspect the configuration setting for People View
SELECT CAST(DataRec AS TEXT)
FROM ConfigTable
WHERE RecID=1;

The result is a long collection of XML tags and values that control many things on opening the database. The People View columns are defined by one set of XML tags for each column of the form:

<PersViewCol11><FieldType>10000</FieldType><EventType>4</EventType><DataType>4</DataType></PersViewCol11>

where, in this example, Column 11 (0 being the first column to the right of the person’s name)is EventType 4 (the Burial fact) and DataType 4 is the Place Detail for that fact.

What we want to do is to reduce the number of joined tables by reducing the number of columns. Before doing so, use RM to make a backup of the database and then exit RM.

Now copy the entire result of the above query to a text editor such as PSPad or an XML editor such as XMLPad. The latter is very convenient because you can see the XML in a table view:
PeopleViewSettings.PNGHere, the highlighted block is the snippet of XML from above.

Reduce the Number of Columns

Delete some of the highest numbered columns making sure that you have deleted each pair of <PersViewCol#>…</PersViewCol#> tags and all between. Do not delete from anywhere else; gaps in the column numbering will give unpredictable results.

Copy the resulting source code (XML text) into the following UPDATE query and execute:

-- Revising the People View settings
-- paste the modified XML text over
-- "modifiedXMLtext", preserving the
-- surrounding single quotes as shown
 
UPDATE ConfigTable
SET DataRec = CAST('modifiedXMLtext'
AS BLOB)
WHERE RecID = 1
;

Re-open the database with RootsMagic and inspect People View. If the same error persists, repeat the procedure to delete more columns. If a different error arises, you have made an error in the procedure – start over from your backup.

Corrupt Database Recovery #database

Risk

Despite its reputation as a robust database system, SQLite is nevertheless vulnerable to disk degradation and disruptions to its disk write operations by power glitches, system crashes, etc. Thus there have been reports of the dreaded error message: SQLite Error 11 – database disk image is malformed. Other error messages may arise from corruption but this is the most common one. See the full list of SQLite result codes.

Backups may not help

RootsMagic does not exploit SQLite’s journal and rollback capabilities that could recover from some failures. Corruption may occur without an error message arising for some time because it occurred in an area of the database not currently in use. Moreover, the RootsMagic backup process won’t detect it and will faithfully preserve the corruption. Hence, when this error pops up, the question naturally follows “What do I do now?”. Winding through the backups may prove very frustrating.

Some recovery techniques

Here are some techniques I have used to recover all or some of a database, more or less in ascending order of the severity of the problem and the complexity of the recovery:

  1. Drag and drop (selecting Everyone) to a new database. This can work if the corruption affects only a part of the database that is used for a certain kind of report or display, for example an index for a certain table.
  2. Alternatively, export Everyone to GEDCOM and import that to a new database; that is equivalent to (1) in terms of the data transferred but we do not know if it is in any way a different SQLite call. If (1) fails and this export fails, then you can exclude many kinds of data for simpler export using fewer aspects of the database. Start with the most basic GEDCOM export; if it fails, skip to (3). Otherwise, progressively add elements to export until it fails – you may be lucky and have exported everything you want. Remember that there are GEDCOM settings in the FactType List that affect Drag’n’Drop the same as GEDCOM; you’ll need to check all FactTypes for inclusion in GEDCOM so you don’t lose data that is perfectly recoverable. Set the database you have created from DnD or from GEDCOM aside for later comparison with the results of the next steps.
  3. Even if the DnD/Export succeeds, and certainly if it doesn’t, we have to resort to SQLite to be sure to recover the most complete set of data . Create a new, empty RootsMagic database file and open it with SQLiteSpy with the RMNOCASE extension, or equivalent. Then ATTACH the corrupted database. For example: “ATTACH ‘C:UserTomFamily TreeMyFamily.rmgc’ AS Old ;”. Open each table of the corrupted database one at a time and note which ones cause an error message.
  4. Arguably, this step should follow the next – if it were to show that a critical table could not be sufficiently recovered, there is no point going further. For each table that does NOT cause an error message, copy its records into the corresponding table of the new, main database using the command (e.g. for the NameTable): “INSERT INTO NameTable SELECT * FROM Old.NameTable ;”. Revise and repeat for each table except for some which have built-in records such as the FactTypeTable, PlaceTable, RoleTable and SourceTemplateTable; the latter will require a command which includes a WHERE constraint or change to “INSERT OR IGNORE INTO …” to skip over the existing ones. Perhaps “INSERT OR REPLACE INTO…” is better as that will capture any customisations of FactTypes and Roles. The new database now has a perfect replica of the old, uncorrupted tables.
  5. For each table that DOES cause an error message, only partial recovery is possible: from the first record to the last contiguously uncorrupted record, and, possibly, by further iterations, some records beyond the corruption. Open a corrupted table and ignore/close the error message. Scroll down the results to where corruption is encountered. Select and copy to clipboard all above that point. Paste the copied records into a text editor which supports regular expression search & replace, such as PSPad, or into a spreadsheet such as Excel. For very large results it may be necessary to do this in chunks to respect the limits of the text editing or spreadsheet program. Using the editing or spreadsheet tools, we need to transform this extract from the NameTable:

 

NameID OwnerID Surname Given Prefix Suffix Nickname NameType Date SortDate IsPrimary IsPrivate Proof EditDate Sentence Note BirthYear DeathYear
...
17 16 Hansen Frances Lorraine 0 . 9223372036854775807 1 0 0 0.0 1937 1939
18 17 Gibson Chester Herbert 0 . 9223372036854775807 1 0 0 0.0 1895 1949
19 18 Straub Florence Amelia 0 . 9223372036854775807 1 0 0 0.0 1896 1942
...

into this SQLite script:

BEGIN TRANSACTION;
...
INSERT INTO NameTable VALUES(17,16,'Hansen','Frances Lorraine','','','',0,'.',9223372036854770000,1,0,0,0,NULL,NULL,1937,1939);
INSERT INTO NameTable VALUES(18,17,'Gibson','Chester Herbert','','','',0,'.',9223372036854770000,1,0,0,0,NULL,NULL,1895,1949);
INSERT INTO NameTable VALUES(19,18,'Straub','Florence Amelia','','','',0,'.',9223372036854770000,1,0,0,0,NULL,NULL,1896,1942);
...
COMMIT TRANSACTION;

By examining the CREATE statement for the table, we can tell which fields are numeric (no quotes required), text (single quotes required) and binary or BLOB (requires CAST). In the above example, the Sentence and Note fields are binary text but there were no values so null could be used and was easier. Here’s an extract from another table which did have values in some BLOB fields:

PersonID    UniqueID    Sex    EditDate    ParentID    SpouseID    Color    Relate1    Relate2    Flags    Living    IsPrivate    Proof    Bookmark    Note
...
1165    979205DC09A94799B253CDBE51D90C137599    1    40853.0    0    0    0    0    0    0    0    0    0    0
1166    F79C9B38AFE44F619D4809724B3BAB134DFB    0    40853.0    0    0    0    0    0    0    0    0    0    0    Church records have Thomas living in 1850.
Could there have been 2 Thomas's in this family?
Bap. 26 feb 1971 SL. end. 1 apr 1971 Sl.Children's work done from 1980 census.
 
1167    E55E52812ECA44E8874FD0DB88750F4D14F3    0    40853.0    0    0    0    0    0    0    0    0    0    0
 
...

These need to be transformed into this SQLite script:

BEGIN TRANSACTION;
...
INSERT INTO PersonTable VALUES(1165,'979205DC09A94799B253CDBE51D90C137599',1,40853.0,0,0,0,0,0,0,0,0,0,0,CAST('' AS BLOB));
INSERT INTO PersonTable VALUES(1166,'F79C9B38AFE44F619D4809724B3BAB134DFB',0,40853.0,0,0,0,0,0,0,0,0,0,0,CAST('Church records have Thomas living in 1850.
Could there have been 2 Thomas''s in this family?
Bap. 26 feb 1971 SL. end. 1 apr 1971 Sl.Children''s work done from 1980 census.
 
' AS BLOB));
INSERT INTO PersonTable VALUES(1167,'E55E52812ECA44E8874FD0DB88750F4D14F3',0,40853.0,0,0,0,0,0,0,0,0,0,0,CAST('' AS BLOB));
...
COMMIT TRANSACTION;

Converting data to SQlite script

This is not a tutorial on regular expression search & replace. You can find those elsewhere. Whatever regular expression tool you use, there is a general order that needs to be followed:

  1. Because the apostrophe demarks a string in SQLite syntax, possessive words such as “John’s” or other literal uses of the apostrophe requires it to be escaped (double apostrophes) before you wrap strings with single apostrophes. So the first step is a normal search for ‘ and replace with ” (that is two apostrophes, not a double quote).
  2. The data values are separated by the Tab character. I tend to proceed then with replacements from left to right, using the Tab character to define the pattern and how it gets replaced at each position. You can find the type of each column by inspecting the SQLite command that creates the table; with SQLiteSpy, right-click on the table name in the left sidebar and select “Show CREATE statement”. It may take several iterations of search and replace for a table with many columns to arrive at a complete and syntactically correct INSERT statement from each row of the original table.
  3. A multi-line field (with embedded new line codes as in the above example) is not manageable with PSPad’s search & replace so requires manual editing. There are other tools which can handle it – my favourite being Bill Klein’s ReplaceText. Regrettably, it is no longer supported and reportedly has some problems with certain Windows 7 installations, although I have not witnessed any.
  4. Any remaining tab characters can be replaced globally with commas.

 

Finishing

Having used a fake RMNOCASE collation to build the data in the new database, the indexes may not jibe with RootsMagic’s inherent RMNOCASE. Open the new database with RootsMagic 5 (yes 5, not 4) and use its File > Database Tools > Rebuild Indexes tool. Then look at what you got from the DnD/Export versus the SQLite copying and choose to carry on with the one that seems most complete.

Discussions & comments from Wikispaces site


ve3meo

Drag ‘n’ Drop vs Export “everything”

ve3meo
10 March 2012 19:40:35
Added by Jerry Bryan 3/10/2012

(Tom, I’m sometimes still figuring out how to work the Wiki. I was just wanting in some sense to REPLY to this page and not really edit it, but I couldn’t figure out a way to do so. Please free to delete my comments from here and move them somewhere else.)

This page is a wonderful cautionary tale. It made me think that maybe once a week or so I should just drag and drop my entire database somewhere else, just to see what happens. I wouldn’t really use the copy, but maybe the drag and drop of the entire database might expose invisible database corruption that might otherwise remain invisible. Is that what you are saying? If so, then I would have one very minor quibble. Namely, in item (2) under recovery techniques, you say: “If you check off to include everything possible in the export, it is equivalent to (1).”

Item (2) is the export and item (1) is the drag and drop. The way I read the sentence I’m quoting, there is an expectation that drag and drop will include everything and that export will include everything only if you check to include everything possible. But my understanding is that drag and drop is fully equivalent to export, and to do a proper drag and drop of “everything” you would have to “check off to include everything possible” just like you would if you were doing an export of “everything”.

You can post messages “behind” the page. You can also Edit the page, select a key phrase and add a comment linked to the phrase. The phrase will be highlighted in yellow and the comments sidebar can be opened and closed to view the comment. The comment will also appear as a message “behind” the page.

I realise now after Geranium’s msg that Exporting Everyone with all the inclusions checked and exclusions unchecked is not as complete as Drag’n’Drop Everyone because some Fact settings exclude elements from export but not from DnD. To be truly equal, you would also have to go through the FactType List and include everything in it for export.

Tom


thejerrybryan
thejerrybryan
11 March 2012 01:14:29
  • I realise now after Geranium’s msg that
  • Exporting Everyone with all the inclusions
  • checked and exclusions unchecked is not
  • as complete as Drag’n’Drop Everyone
  • because some Fact settings exclude
  • elements from export but not from DnD.

My experience is that DnD honors Fact settings and therefore causes certain Facts to be omitted, just like Export. I don’t think there’s any way to make DnD get everything without messing around with lots of Fact settings. Am I missing something obvious?

Jerry

Place Errors #placedetails #places

This page is an outgrowth from Place Details without a Place. There is the possibility to add Orphaned Place Details since at least RM4 because the program does not fully preclude it. A suspected bug or procedural cause in the Split Place function of RM 5.0.2.1 also may be contributing errors resulting in the loss of a Place. The queries developed on that page do not cover all the cases in one easy-to-use report. That is the goal of this page.

Given the structure of the RootsMagic database, one can identify three kinds of errors which result in the loss of a Place or Place Detail for an event:

  1. Lost Places – the PlaceID pointer for the event cannot be matched in the PlaceTable.
  2. Lost Place Detail – the SiteID pointer for the event cannot be matched in the PlaceTable
  3. Orphaned Place Detail for which there are two sub-types:
    1. Used by an event: the SiteID pointer is matched in the PlaceTable but that PlaceDetail’s MasterID (its parent’s PlaceID) is not (the parent Place is lost).
    2. Unused: a Place Detail in the PlaceTable, whose MasterID (its parent’s PlaceID) is not, that is not used by an event.

The prior page and queries initially focussed on #3. This more comprehensive query reports all three types.

PlaceErrors3.sql This query requires a SQLite manager that supports a fake RMNOCASE collation else must be edited to override RMNOCASE with COLLATE NOCASE clauses in a few places. Alternatively, it will be available in RMtrix.

PlaceErrors3.PNG
Screenshot of results from PlaceErrors3 query using SQLiteSpy with the fake RMNOCASE extension.

The Person, RIN, Year, Fact and Place Detail columns should prove helpful in finding the affected events using RootsMagic Explorer. In all cases, the Place will be blank in the Edit Source screen. The Place Detail, if not blank, may provide a clue to what Place it should be. RootsMagic’s Place List will not show any of these Place Details.

For those wishing to examine the database tables, the four numeric fields will help: the first two fields are the PlaceID and SiteID fields of the EventTable table; the last two are the PlaceID and MasterID fields of the PlaceTable table for the Place Detail corresponding to the SiteID of EventTable.

Use PlaceErrors3 to find these errors and take corrective action before entering into more place-splitting. The Unused Place Detail w/o Place error is easily removed using the OrphanedPlaceDetails_DeleteUnused.sql query described earlier on Place Details without a Place. Once having cleared all the problems, then run the query after each Place has been split into Place and Place Detail to confirm no new errors have been introduced.