Query to determine if any matching source citation exists.
Posted: 01 Oct 2015 20:36
I have some cases where individuals' events (birth/death etc) cite multiple sources.
What I am trying to do is write a query that will find me individuals (or facts) that have *any* source which matches my criteria (i.e. for birth events where source.type='Birth Index' and source.repository.name='FreeBMD').
In my fact query, I end up with columns using expressions something like this:
=IsTrue(%FACT.SOUR>_TYPE% = "Baptism Index") which as far as I can tell from the help file is equivalent to:
=IsTrue(%FACT.SOUR[1]>_TYPE% = "Baptism Index")
But this only matches the first source associated with a fact - I want to check whether any source associated with a fact matches the criteria.
Do I need to make assumptions about the max number of source citations per fact (3 in this example) and write a query expression like:
=IsTrue(%FACT.SOUR[1]>_TYPE% = "Baptism Index" or %FACT.SOUR[2]>_TYPE% = "Baptism Index" or %FACT.SOUR[3]>_TYPE% = "Baptism Index" ) ?
As an aside is there any way to get the counts of related records such as the number of source citations per fact/event?
What I am trying to do is write a query that will find me individuals (or facts) that have *any* source which matches my criteria (i.e. for birth events where source.type='Birth Index' and source.repository.name='FreeBMD').
In my fact query, I end up with columns using expressions something like this:
=IsTrue(%FACT.SOUR>_TYPE% = "Baptism Index") which as far as I can tell from the help file is equivalent to:
=IsTrue(%FACT.SOUR[1]>_TYPE% = "Baptism Index")
But this only matches the first source associated with a fact - I want to check whether any source associated with a fact matches the criteria.
Do I need to make assumptions about the max number of source citations per fact (3 in this example) and write a query expression like:
=IsTrue(%FACT.SOUR[1]>_TYPE% = "Baptism Index" or %FACT.SOUR[2]>_TYPE% = "Baptism Index" or %FACT.SOUR[3]>_TYPE% = "Baptism Index" ) ?
As an aside is there any way to get the counts of related records such as the number of source citations per fact/event?