Changes between Version 7 and Version 8 of S3XRC/ResourceReport


Ignore:
Timestamp:
08/28/10 12:34:35 (15 years ago)
Author:
Dominic König
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • S3XRC/ResourceReport

    v7 v8  
    141141}}}
    142142
     143
     144=== The sum of all values in a field... ===
     145
     146The case:
     147Your resource contains a "timestmp" field (type datetime) and a field "cost" (type double), and now the user shall select a time interval in aform, and your report function shall provide the sum of all "cost" for those records with a timestmp within the selected time interval.
     148
     149Let's go:
     150
     151First of all, we implement our method handler as before:
     152
     153{{{
     154def shn_xxx_yyy_report(r, **attr):
     155
     156    # Report generating code goes here
     157
     158s3xrc.model.set_method("xxx", "yyy", method="report", action=shn_xxx_yyy_report)
     159}}}
     160
     161Now we add the HTML representation:
     162
     163{{{
     164def shn_xxx_yyy_report(r, **attr):
     165
     166    if r.representation == "html":
     167        output = dict()
     168        return output
     169
     170s3xrc.model.set_method("xxx", "yyy", method="report", action=shn_xxx_yyy_report)
     171}}}
     172
    143173...to be continued...
    144 ...to be continued...
    145 ...to be continued...
    146 ...to be continued...