Autocalctable adds summation/average/min/max values of a column of a table imported from page containing json/module/csv.
Module information
Functions
getTable
Extracts table columns containing numbers.
Parameters
| Name | Type | purpose |
|---|---|---|
| sPage | string | A page containing the table e.g Module:Scores.json. |
| sType | string | The type of data contained in the page (csv, json, lua) -lua table. |
| Return type | Return purpose |
|---|---|
| string | A table containing calculated columns. |
p.main
Entry point - Creates a table with automatically calculated columns.
Parameters
| Name | Type | purpose |
|---|---|---|
| frame | table | A scribunto frame. |
| Return type | Return purpose |
|---|---|
| string | A table containing calculated columns. |
p.createHtmlTable
Creates an html table.
Parameters
| Name | Type | purpose |
|---|---|---|
| arrColumns | string | A column containing numbers. |
| calculations | string | The types of calculations to perform (avg, min, max, sum). |
| Return type | Return purpose |
|---|---|
| string | An html table containing calculated columns. |
Syntax[]
{{#invoke:Autotablecalc|main|page = pagename|type = datatype|calc = calculationtype}}
Where calc = sum/avg/min/max - can be more than one separated by commas ,e.g.:
- calc=sum,avg
- pagename =name of page/module
- datatype = json or lua or cvs
Example[]
| Code | Output | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| {{#invoke:Autocalctable|main|page=Module:Autocalctable/testdata|type=lua|calc=sum}} |
|
| Code | Output | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| {{#invoke:Autocalctable|main|page=Module:Autocalctable/testdata|type=lua|calc=sum,avg}} |
|