Page 1 of 1

Query over a date range.

Posted: 01 Sep 2016 16:36
by rallanb
FH 6.2 used
I am trying to extract individuals based on their military service. My query works for single dates but not for date ranges.
The attached Results does show one record with a date range, but this is a "False positive" as Harry Beeby also has single date for Military ID.
I have also changed a previously found record that had a single date to a date range, but this now fails.

The selection criteria used is attached (Select), as well as one of the records I expected to find...

I do hope that I am doing something wrong and that it is possible to select date ranges.

Best regards
Allan Beeby

Re: Query over a date range.

Posted: 01 Sep 2016 17:32
by Jane
Try removing the YEAR qualifier or using XDATE1

Re: Query over a date range.

Posted: 01 Sep 2016 18:22
by tatewise
May I comment on your use of Date Range in this context.

As the Date Entry Assistant in your posting says: "... Do not confuse this with specifying a period (see Period tab)."
In your example it is saying J W Beeby was in Military Service on some specific Date between 1914 and 1919.
Whereas what I think you mean is J W Beeby was in Military Service all the time from 1914 to 1919.

The general advice is that Events use a Date Range for a non-specific day, because Events usually only happen on one day, such as Birth, Marriage, Census, Death.

Whereas Attributes use a Date Period for the duration that they apply, such as Residence, Occupation, Military Service.

In fact that advice is prescribed in the Gedcom specification.

BTW: If you really need to obtain the Year from any Date the following advice applies.
The %...DATE:YEAR% qualifier only works for a simple date and NOT Date Period or Date Range.
Use the =Year(%...DATE%) function which gives the year of a simple date or the first date of a Date Period or Date Range.

Re: Query over a date range.

Posted: 05 Sep 2016 10:44
by rallanb
Many thanks

The difference between the two date periods is obvious, once it has been explained. Thanks again for that.
Also I should have seen that a date range is catered for. (DATE1 and DATE2)

The code as below gives me exactly what I was after.
FH Query date range Answer.JPG
FH Query date range Answer.JPG (33.03 KiB) Viewed 3295 times
Once again
Many thanks