Hi!

I have to agree with Scott that a sourceField-Property is not very
useful. It would greatly add to the complexity of MetaCard without
adding very much functionality. If you want to use it as a viewer for
data in a different stack, you can easily the following generic handlers
the stack script:

on showRecord r
  -- r is the long id of the cd containing
  -- the sourceFields of the same name (for simplicity)
  repeat with i=1 to the number of fields
    put the sourceField of fld i into s
    if s is empty then next repeat
    do "set the htmlText of fld i to the htmlText of"\
        && "fld "& the short name of fld i && "of" && r
  end repeat
end showRecord

on closeField
  put the sourceField of the target into s
  if s is not empty then
    set the htmlText of s to the htmlText of the target
  end if
  pass closeField
end closeField

It would be nice to have a function "the fieldIds" so the repeat loop
could be made more efficient, but that's a different thread.

If you want to use it for relations, e.g. you have an invoice and a
customer stack and you want a field on the invoice to display the
customer id, then a sourceField property is not sufficient, because you
may want to display the customer name in addition. You may add another
field for that... and still more if you want to see the address... but
as you may see setting or updating the customer will add a lot of
overhead. Or you may add a field to the customer that includes all the
data you need on the invoice, but when you want to change the invoice,
you'll have to change the customer stack as well (which is very much an
issue in larger projects).

My suggestion is to add the following handler to the stack script:

on openCard
  set the htmlText of fld "customerInfo" to\
      the htmlText of fld "name" of cd id (fld "customerId")\
      of stack "customer"
  pass openCard
end openCard


There are so many questions you'll come up with as soon as you have the
sourceField property, that i don't see the need for it. Moving the text
is only a small portion of the problem.


Regards
  Rüdiger

--------------------------------------------------------------------
   GINIT - Gesellschaft fuer integrierte Informationssysteme mbH
--------------------------------------------------------------------
GINIT GmbH
Ruediger zu Dohna                        email:       [EMAIL PROTECTED]
Technologiepark                          phone:     +49-721-96681-63
Emmy-Noether-Str. 9                      fax:       +49-721-96681-11
D-76131 Karlsruhe                        www:    http://www.ginit.de
--------------------------------------------------------------------
  PGP-Fingerprint: F1 BF 9D 95 57 26 48 42 FE F8 E8 02 41 1A EE 3E 
--------------------------------------------------------------------

Reply via email to