jethro-pmm icon indicating copy to clipboard operation
jethro-pmm copied to clipboard

Derived fields

Open tim-pearce opened this issue 1 year ago • 4 comments

Jethro currently has the concept of user defined fields, which is useful. In document merge I have found it useful to create derived/calculated fields. An example being a comma separated list of people on the roster for a particular role on the same date. It would make sense to push these into the database classes. Furthermore, particularly for person and family, there could be a call to a function in config.php to allow site specific calculated fields. A couple of examples I have in templates for contact list, which are quite unique to my installation, are

  • a version of the family telephone number that does not allow mobile numbers
  • a version of a person's mobile number that uses spaces instead of dashes

tim-pearce avatar Jun 14 '23 01:06 tim-pearce

Can you give some more examples / use cases for what these would achieve? I'm not quite getting the need for this yet.

A couple of examples I have in templates for contact list, which are quite unique to my installation, are a version of the family telephone number that does not allow mobile numbers a version of a person's mobile number that uses spaces instead of dashes

See the system config page - you can edit the phone number formats to use spaces instead of dashes. And you could require home phone to be, for example, 8 digits beginning with a 9.

tbar0970 avatar Jun 14 '23 01:06 tbar0970

It sounds like you just want the data formatted differently? That's not really a "derived field" which implies some sort of calculation.

tbar0970 avatar Jun 14 '23 01:06 tbar0970

Point taken and the cases where lists (usually of people) separated by commas is probably not really a field that makes general sense. In that instance too, putting new lines instead of commas into a document requires some knowledge of how they are represented in that particular document type.

tim-pearce avatar Jun 19 '23 02:06 tim-pearce

OK perhaps the better idea here is "special flavours of keywords for mail merge" ?

tbar0970 avatar Jun 27 '23 10:06 tbar0970