Genealogy software for Palm Pilot??
Date:         Sat, 11 Sep 1999 22:52:11 -0400
From: Marc Nozell <marc@NOZELL.COM>
Subject:      Re: Genealogy software for Palm Pilot??
To: LINES-L@LISTSERV.NODAK.EDU
In-Reply-To:  Marc Nozell's message of "Sat, 11 Sep 1999 09:19:12 -0400"

>>>>> "Marc" == Marc Nozell <nozell@ROOTSWEB.COM> writes:

>>>>> "Al" == Al Wootten <awootten@NRAO.EDU> writes:
    Al> I've often thought it would be useful to have my database
    Al> available on a PalmPilot.  I'm not expecting a LifeLines port
    Al> anytime soon.  However, has anyone found any such software and
    Al> was it useful?

    Marc> I hacked something.

    Marc> I wrote a LifeLines script that dumped of the database,
    Marc> massaged it with a perl script into a CSV format and then
    Marc> pushed it into Tom Dyas' Open Source DB for the Palm.
    Marc> (http://sourceforge.net/projects/pilot-db/)

    Marc> It's ugly, but serviceable.

It isn't quite as ugly now.

Below is the code.  Comments are more than welcome!

-marc
--
Marc Nozell <marc@nozell.com>           http://www.nozell.com
------------------------------------------------------------------------
/*
 *   db-index.ll V1.0
 *
 *   Marc Nozell <marc@nozell>                11-Sep-1999
 *
 *   This report works only with the LifeLines Genealogy program
 *
 *   It will produce a report of all INDI's in the database, with
 *   sorted names as output for inport into Tom Dyas' Open Source DB
 *   PalmOS app.
 *
 * 1) Obtain Kenneth Albanowski's <kjahds@kjahds.com> pilot-link
 *    package.  The Microsoft Windows based Palm desktop should also
 *    work.
 *
 * 1) Obtain Tom Dyas' <tdyas@vger.rutgers.edu> "DB: Open Source
 *    Database Program for PalmOS" and supporting tools from
 *    http://sourceforge.net/projects/pilot-db/
 *
 * 2) Run this lifelines report and save the result in say, db.out
 *
 * 3) Run the CSV to PDB conversion tool like this:
 *            ~/db/tools/csv2pdb db.out db.pdb "Genealogy"
 *
 * 4) Install the converted info to the Palm device like this:
 *            pilot-link -i db.pdb
 */

proc main ()
{
  indiset(idx)

    /*  monthformat(4) */

    /* Grab them all */
    print("Please wait...")
    forindi(indi,n) {
        addtoset(idx,indi,n)
    }
    print(nl()) print("Found ") print(d(n)) print(" people.")
    print(nl())
    print("begin sorting") print(nl())
    namesort(idx)
    print("done sorting") print(nl())

    col(1) "ID,Name,Birth,Death,SpouseID,ChildrenID,FatherID,MotherID" nl()

    forindiset(idx,indi,v,n) {
        col(1) "\"" key(indi) "\""
        ","
        "\""fullname(indi,1,0,30) "\""
        ","

        call showvitals(indi)
        call showspouse(indi)
        call showkids(indi)
        call showparents(indi)
        print("+")
        }

        nl()
        print(nl())
}

/************************************************************************/
proc showvitals (i)
{
    set(b, birth(i))
    set(d, death(i))
    if (and(b, short(b))) {
        "\"" long(b) "\""
    }
    else {
        "\" \""
    }

    ","

    if (and(d, short(d))) {
        "\"" long(d) "\""
    }
    else {
        "\" \""
    }
}

proc showparents (i)
{
    ",\""
    if(fath,father(i)) {
        "(" key(fath) ") "
    }
    else {
        "unknown"
    }

    "\""

    ",\""

    if(moth,mother(i)) {
        "(" key(moth) ") "
    }
    else {
        "unknown"
    }
    "\""
}
/************************************************************************/
proc showspouse (i) {
    ",\""
    if (eq(1, nspouses(i))) {
        spouses(i, s, f, n) {
            name(s) "(" key(s) ") "
        }
    }
    else {
        spouses(i, s, f, n) {
        ord(n) /* First, Second ... */
        " " name(s) "(" key(s) ") "
        }
    }
    "\""
}

/************************************************************************/
proc showkids (i) {
    ",\""
    set(j, 0)
    families(i, f, s, n) {
        set(j, add(j, nchildren(f)))
    }

    if (eq(0, j)) {
        " "
    }
    else {
        if (eq(1, j)) {
            "Child: "
        }
        else {
            d(j) " Children:"
        }
        set(j, 1)
        families(i, f, s, n) {
            children(f, c, m) {
               " (" key(c) ")"
                set(j, add(j,1))
            }
        }
    }
    "\""
}


This page last updated October 18, 2000 (to fix links).