Forum

Please or Register to create posts and topics.

Converting only a Part of a Fact type to another type

Hi Folks:

I  am wanting to  convert some of my residence facts to Census facts.   I looked at the following query: https://sqlitetoolsforrootsmagic.com/facts-change-fact-type/  but it changes all of them.  I only want to change them based on:

  1. their being a residence fact.
  2. The residence fact needs to fall on a census year

I would like to be able to enter I guess into a where statement something like DATE = 1940   (to convert only those residence events that are also on Census Years (1940, 1930, 1920.  I would do one year at a time.  There are some non-standard ones  like 1911 englands)

Is there already an sql file that I'm missing that might be able to do something like that?

Thanks,

Matthew

There is no script here that does exactly what you want. If your events are not shared, the script http://sqlitetoolsforrootsmagic.com/wp-content/uploads/2019/01/Facts-ChangeType.sql could have an added constraint on the UPDATE's WHERE clause to filter on the date. It could probably be a run-time variable.

The following illustrates the constraint on the event date by year:

SELECT * FROM EventTable
WHERE 1 -- constraint for year of event follows
AND
Date LIKE '___'||:YYYY||'%'
;

This uses the runtime variable :YYYY but you could substitute a string year in the expression, e.g., LIKE '___'||'1920'||'%'  or, more simply, LIKE '___1920%'.