Re: Parsing of numeric values
Denis Bredelet <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
>>> Daniel Dekany wrote: >>>> >>>> Tuesday, September 15, 2009, 3:46:17 PM, wkbutler wrote: >>>> I don't know... it's not enough concrete for me to form an opinion. >>>> The part that is a bit suspicious for me, that if the numerical output >>>> generated by the 1st order macros meant to be treated as numbers by >>>> the 2nd order macros, then why are they in human-audience format? I >>>> mean, FM can output in computer-audience numerical format as well. >>>> >>> >>> Good question - consider the case of subtotals and grand totals. Grand >>> totals operate on subtotals, subtotals operate on 'raw' data. Both are >>> products for the user. You allude to another possible solution though, >>> which is to store both formats; I would rather avoid that, but it may be >>> the >>> easiest approach. >> >> In principle you don't generate the grand totals from the formatted >> output of the subtotals. You just generate them from the >> presentation-independent data that represents the subtotals. >> Extracting data from formatted output is quite difficult in general >> (since that output is optimized for human brains, not for computer >> programs), and thus avoided whenever possible. >> >> Of course, building presentation-independent data structures is not >> something FM is often used for, since it generates text, not Java >> objects and like. But, there are some exceptions, when FM generates >> XML or JSON, which are not about presentation but describing >> structured "data", and still are text. >> > >Yep I'd agree completely, ordinarily. But the way this system is designed, >the raw data is actually unknown to the system. The user is in control of >the raw data content and all macros. Hence only the user knows which data >points are numeric (string representation of numerics of course), and how he >wants to use the data. > >I guess that means the user should be responsible for setting up two >versions of each numeric macro. I may fall back to that solution, it >probably is the safest for the reasons you mention. But for maintenance >concerns on near-duplicate macros, I press on... In fact since you are using macros for data processing all your macros should produce computer-audience numbers. Only when a number reaches the view it should be formatted for human audience. -- Denis. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july