Hi David,

> Essentially I can calculate age based off of DOB with a (dm T ...) line 18
> but then that record won't show in the search dialog. When lines 13-20 are

You are quite close :)

The problem is the way your 'T' method is defined:

   (dm T (name NAME prefname PREFNAME sex SEX dob DOB email EMAIL txt TXT)
      (=: name NAME)

This is not how it works. You could either define it as

      (=: name NAME)

and then call 'new!' (which is implied in the 'newButton' function):

   (new! '(+Person) *Name *PrefName ...)

OR (and this is how I would do it), use the fact that the 'new' and
'new!' functions, and also the 'T' method of the '+Entity' parent class,
accepts arguments as alternating keys and values:

   (dm T (DOB . @)
      (pass super)  # Pass remaining arguments to the parent class
      (=: age (/ (- (date) DOB) 365)) )

or, directly,

   (dm T (DOB . @)
      (pass super  'age (/ (- (date) DOB) 365)) )

and then call it as

   (new! '(+Person) DOB 'name *Name 'prefname *PrefName ...)


   (newButton T Dst '(+Person) DOB 'name *Name 'prefname *PrefName ...)

BTW, a year has more than 365 days. A somewhat more accurate calculation
might be

   (*/ (- (date) DOB) 100 36525))

Besides the fact, of course, that storing the _age_ in the database
doesn't make sense, It is soon out of date ;-)

> Also, what is the idomatic way to include an outside .js file in
> <head>...</head>?

The best is to push the file name into the global '*JS' variable
before program start:

   (push1 '*JS (allow "myFile.js"))

Examples for that are in "lib/form.l" or "lib/canvas.l".

♪♫ Alex
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to