Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Search for Living Relatives born after a certain date
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Nairn John  
View profile  
 More options Jul 4 2011, 10:37 am
From: Nairn John <johnana...@gmail.com>
Date: Mon, 4 Jul 2011 16:37:06 +0200
Local: Mon, Jul 4 2011 10:37 am
Subject: Re: Search for Living Relatives born after a certain date

I am not exactly sure what the goal of the scripts are, but I expect you are not getting what you want with comparisons like

if bday > "01 01 1915" then

This is doing a string comparison and Apple Script will not recognize the strings as dates and therefore will not compare them as dates; they will rank in alphabetical order. Furthermore, the property "birth date" will return the date in GEDCOM format so it will be something like "12 NOV 1934" and not numbers (you can get numbers if you want by using date format conversions).

If you are trying to do date comparisons, you should always be using date SDNs (for serial day numbers). These are day numbers assigned to dates (starting from about 4000 BC). You can compare SDNs (because they are numbers) and it will work for any calendar (because the date is converted to a number). You probably want something like

set sdnRange to sdn range full date "1 JAN 1915"
set minSDN to item 1 of sdnRange
tell item i of indisRef
    set bday to birth SDN
    if bday >= minSDN
        -- this person has a valid birth date that is after or on 1 JAN 1915
        -- do any desired calculations
    end if
end tell

I did not test this in Script editor, but I think the basic ideas are correct. The first line converts date "1 JAN 1915" to an sdnRange in a list. Since it is an exact date, the list will have two identical numbers. The next line loads the first item into a variable. Now when looking at the individual, grab the birth SDN (and not the date text). This SDN can be compared to the one calculated in minSDN. If the birth date is not an exact date (e.g., 1934), the "birth SDN" property will give the minimum possible SDN (for "1934" it would be SDN for "1 JAN 1934). If it matters, you can retrieve the "birth SDN max" as well which has the maximum possible SDN for non-exact dates (for "1934" it would be SDN for "31 DEC 1934").

The second script also has some errors. It does an age calculation only if death date is empty. But that means there is no death date. The property death SDN will therefore return 0 (which for SDNs means no date or an invalid date). The age calculation will thus give birth SDN/365.25 which will always be very large numbers (around 6000 for people born in 20th century).

Once inside the conditional (as corrected above) you probably want

set dday to death date SDN
if dday > 0 then
    set age to (dday - bday) /  365.25
    if age > 0 then
        -- thus person has known birth and death dates and was over 80 at death
    end if
end if

For a refinement, you might want to use (death SDN max - birth SDN) / 365.25, which will catch everyone that could have been 80 when they died (i.e., age calculated from maximum number of days they were alive based on recorded date information). Or possibly (death SDN - birth SDN max) / 365.25 , which will only catch those that were certainly over than 80 based on records date information (i.e., age calculated from minimum possible days they were alive).

To see some date calculations in action, you can look at the "Age Analysis Report" script (you can open it for viewing by selecting in from the scripts menu in GEDitCOM II while holding down the option key).

On Jul 3, 2011, at 7:59 PM, daa wrote:

> OK, so I have been looking at some of the canned scripts and have come up with the following (snippet from a longer version) that works, almost, it gets dates in the 1800's. I'm a little confused as to how the dates are handled apparently. Any ideas?

>            tell item i of indisRef
>                    set bday to birth date
>                    if bday > "01 01 1915" then
>                            if death date = "" then
>                                    set theLine to {first name, middle name, surname, life span} of item i of indisRef
>                                    copy theLine to the end of indi_list
>                            end if
>                    end if
>            end tell

> I was also playing around with this:

>    tell item i of indisRef
>                    --set bdate to (date year of birth date)
>                    --if bdate > "1915" then
>                    set bdate to birth date
>                    if bdate > "01 01 1915" then
>                            if death date = "" then
>                                    --set ddate to date today
>                                    set age to (birth SDN - death SDN) / 365.25
>                                    if age > 80 then
>                                            set theLine to {first name, middle name, surname, life span} of item i of indisRef
>                                            copy theLine to the end of indi_list
>                                    end if
>                            end if
>                    end if
>            end tell

------------
John Nairn
http://www.geditcom.com
Genealogy Software for the Mac

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.