Subject CALCULTED field against UDF
Author Lester Caine
I have a little 'XML' processing to address and I'm not sure what is the best
way of processing it. On property information we used to have secondary and
primary text. These have each been expanded to 5 fields each with a nice XML
schema to define them, but what I need to do for the legacy stuff is to
generate the single text field again.
A simple concatenate would probably do, apart from the problem of NULL entries
and the like, but ideally only fields with values are included and some
additional text needs including depending on the fields supplied.

<start_number>
[ || <start_suffix> ]
[ || - || <end_number> [ || <end_suffix> ]

if any numbers AND <text> then [ || , || ]
else <text>

Where the square bracket stuff is added only if the fields have content.

Currently I'm just sorting it out in PHP before the record is inserted,
working from the raw csv data, and adding a dummy field for it, but the
problem is updating that field later if any of the other 5 change.

I'm not sure it can even be done with a CALCULATED field?
Am I better of building a UDF to handle it?

Basically while I should always be handling updates via PHP, direct access is
available to the database so you can be sure someone is going to want to make
changes direct :(

--
Lester Caine - G8HFL
-----------------------------
Contact - http://home.lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://home.lsces.co.uk
MEDW - http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Firebird - http://www.firebirdsql.org/index.php