> From: Barry Hoggard [mailto:[EMAIL PROTECTED]]
> Sent: 01 June 2002 19:16
> I don't think the standard HTML::Template has support for formatting
> numbers, dates, etc.
Perrin indicated that you can extend HTML::Template in some way
to accommodate this, but I am not yet sure of the details.
> How do you make sure that it's done consistently in your applications?
> It seems problematic to me to require the programmers to do work when
a
> designer wants to change the number of decimals in a page, for
example.
In our reporting infra we handle this by extending the number of basic
data types to include things like
cash value
quantity
interest rate
market price
and then set up a central store of meta-data that says
xxx => cash value
yyy => interest rate
and then set up the extended data types
cash value => '#,##0.00'
quantity => '#,##0'
we also allow field specific overrides
zzz => '#,###' [blank when zero]
All our components use the meta-data to determine how the result
should look. In Excel, quantities are rendered with both a numeric
value and a picture. Excel itself handles the commify. In PDF, the
rendering component has to create a commified string representation
with the correct number of dps.
By centralising the meta-data and having rendering components that use
your meta-data, you can globally change the accuracy or presentation
rules in all view formats.
At present, all our folks are Perl literate, so the metadata is
very easily managed in a series of Perl modules, but there is
nothing stopping you from storing it in a DB, text file etc and
creating a non-technical user maintenance interface.
Regards
Jeff