-- ColorCode-byConsanguinity1.sql
/* 2016-06-30 Tom Holden ve3meo

Sets color code by relationship distance = PersonTable.(Relate1 + Relate2) using
the default RootsMagic color values 0 (black), 1 (red) to 14 (gray).

There are 14 color codes other than black so 14 distances from the 
root person can be coded. Any beyond that distance are limited to the last color. 


*/

BEGIN
;

-- clear colors
UPDATE PersonTable SET Color = 0
;

-- set color by consanguinity
UPDATE PersonTable 
SET Color = MIN(Relate1 + Relate2, 14)
WHERE Relate1 < 999  --except self and in-laws
;

COMMIT
;
