Fandom Developers Wiki

Autocalctable adds summation/average/min/max values of a column of a table imported from page containing json/module/csv.

Functions

getTable

Extracts table columns containing numbers.
Parameters
NameTypepurpose
sPagestringA page containing the table e.g Module:Scores.json.
sTypestringThe type of data contained in the page (csv, json, lua) -lua table.
Return typeReturn purpose
stringA table containing calculated columns.

p.main

Entry point - Creates a table with automatically calculated columns.
Parameters
NameTypepurpose
frametableA scribunto frame.
Return typeReturn purpose
stringA table containing calculated columns.

p.createHtmlTable

Creates an html table.
Parameters
NameTypepurpose
arrColumnsstringA column containing numbers.
calculationsstringThe types of calculations to perform (avg, min, max, sum).
Return typeReturn purpose
stringAn 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[]

CodeOutput
{{#invoke:Autocalctable|main|page=Module:Autocalctable/testdata|type=lua|calc=sum}}
toysprice
12310
154
13814
CodeOutput
{{#invoke:Autocalctable|main|page=Module:Autocalctable/testdata|type=lua|calc=sum,avg}}
toysprice
12310
154
13814
697