Changes between Version 39 and Version 40 of S3/S3Report
- Timestamp:
- 05/14/18 12:30:22 (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
S3/S3Report
v39 v40 76 76 77 77 == Report Options == 78 Table configurations can contain a `report_options` item, which is a Storage object. This object is used to configure reports and report options form.79 78 80 T he `rows`, `cols`, `facts` and `aggregate` items are lists of available values for the user to select from.79 Table configurations can contain a `report_options` item, which is used to configure reports and the report options form. 81 80 82 The `defaults` property is a Storage object that contains the default values for the report. It can contain a value for `rows`, `cols`, `fact`, `aggregate` and `totals` (as described in [#URLMethods URL Methods]).81 Report_options can contain `rows`, `cols`, `fact` (+optional `methods`), `defaults` and `precision` properties. 83 82 84 The `search` property is a list of S3Search widgets that will allow the report to be filtered. If no `search` property is specified, no filter form will be available. 83 The `defaults` property is a dict that contains the default values for the report. It can contain a value for `rows`, `cols`, `fact`, and `totals` (as described in [#URLMethods URL Methods]). 84 85 The `precision` property can be used to determine the maximum precision of aggregates for a fact field. 85 86 86 87 Here is an example of a `report_options` item: 87 88 {{{#!python 88 report_options=Storage( 89 rows=report_fields, 90 cols=report_fields, 91 fact=report_fields, 92 defaults=Storage( 93 rows="project_id", 94 cols="name", 95 fact="sum(time_actual)", 96 # Older versions of S3Report used this syntax (no longer supported): 97 #fact="time_actual", 98 #aggregate="sum", 99 totals=True 100 ), 101 search=[ 102 S3SearchOptionsWidget( 103 name="project_id", 104 label = T("Project"), 105 field = "project_id", 106 ), 107 ], 108 ) 89 report_options = { 90 "rows": report_fields, # which fields can be pivot table rows (list of selectors) 91 "cols": report_fields, # which fields can be pivot table columns (list of selectors) 92 "fact": report_facts, # possible facts, list of fact descriptors like "method(selector)" 93 "defaults": { 94 "rows": "project_id", 95 "cols": "name", 96 "fact": "sum(time_actual)", 97 "totals": True, 98 }, 99 "precision": { 100 "time_actual": 2, # round aggregations of this field to 2 decimals 101 }, 102 } 109 103 }}} 110 104 … … 114 108 115 109 {{{#!python 116 report_options = Storage(117 fact =[selector1, selector2, selector3],118 methods =[method1, method2], # methods can be omitted, falls back to a list of all supported methods110 report_options = { 111 "fact": [selector1, selector2, selector3], 112 "methods": [method1, method2], # methods can be omitted, falls back to a list of all supported methods 119 113 ... 120 )114 } 121 115 }}} 122 116 … … 124 118 125 119 {{{#!python 126 report_options = Storage(127 fact =[120 report_options = { 121 "fact": [ 128 122 "method(selector1)", 129 123 "method(selector2)", 130 124 "method(selector3)", 131 # Older versions of S3Report used this syntax (no longer supported): 132 #(field1, method1), 133 #(field2, method1), 134 #(field2, method2), 135 #(field3, method1), 136 ], 125 ], 137 126 ... 138 )127 } 139 128 }}} 140 129 … … 142 131 143 132 {{{#!python 144 report_options = Storage(145 fact =[133 report_options = { 134 "fact": [ 146 135 (T("ReportLabel1"), "method(selector1)"), 147 136 (T("ReportLabel2"), "method(selector2)"), 148 137 (T("ReportLabel3"), "method(selector3)"), 149 # Older versions of S3Report used this syntax (no longer supported): 150 #(field1, method1, T("My Report A")), 151 #(field2, method1, T("My Report B")), 152 #(field2, method2, T("My Report C")), 153 #(field3, method1, T("My Report D")), 154 ], 138 ], 155 139 ... 156 )140 } 157 141 }}} 158 142