<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://70.231.62.181/index.php?action=history&amp;feed=atom&amp;title=Module%3ATabular_data%2Fdoc</id>
	<title>Module:Tabular data/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://70.231.62.181/index.php?action=history&amp;feed=atom&amp;title=Module%3ATabular_data%2Fdoc"/>
	<link rel="alternate" type="text/html" href="http://70.231.62.181/index.php?title=Module:Tabular_data/doc&amp;action=history"/>
	<updated>2026-04-23T07:43:31Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>http://70.231.62.181/index.php?title=Module:Tabular_data/doc&amp;diff=21060626&amp;oldid=prev</id>
		<title>imported&gt;Mxn: c:Data talk:COVID-19 cases in Santa Clara County, California.tab#Undated cases column removed</title>
		<link rel="alternate" type="text/html" href="http://70.231.62.181/index.php?title=Module:Tabular_data/doc&amp;diff=21060626&amp;oldid=prev"/>
		<updated>2023-07-09T05:13:57Z</updated>

		<summary type="html">&lt;p&gt;&lt;a href=&quot;/index.php?title=C:Data_talk:COVID-19_cases_in_Santa_Clara_County,_California.tab&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;C:Data talk:COVID-19 cases in Santa Clara County, California.tab (page does not exist)&quot;&gt;c:Data talk:COVID-19 cases in Santa Clara County, California.tab#Undated cases column removed&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Module rating|beta}}&lt;br /&gt;
&amp;lt;!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This module provides basic functions for interacting with [[mw:Help:Tabular Data|tabular data]] on Wikimedia Commons.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;code&amp;gt;cell&amp;lt;/code&amp;gt; ==&lt;br /&gt;
Returns the value of the cell at the given row index and column name.&lt;br /&gt;
&lt;br /&gt;
Usage: {{mlx|{{BASEPAGENAME}}|&amp;#039;&amp;#039;cell&amp;#039;&amp;#039;|&amp;#039;&amp;#039;Page name.tab&amp;#039;&amp;#039;|output_row{{=}}&amp;#039;&amp;#039;Index of row to output&amp;#039;&amp;#039;|output_column{{=}}&amp;#039;&amp;#039;Name of column to output&amp;#039;&amp;#039;}}&lt;br /&gt;
&lt;br /&gt;
A row index of &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; refers to the first row in the table. A row index of &amp;lt;code&amp;gt;-1&amp;lt;/code&amp;gt; refers to the last row in the table. It is an error to specify a row index of &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&lt;br /&gt;
Latest death toll in [[c:Data:COVID-19 cases in Santa Clara County, California.tab]] (regardless of when the table was last updated):&lt;br /&gt;
&lt;br /&gt;
{{#invoke:Demo|module|demo_module={{BASEPAGENAME}}|demo_module_func=cell|COVID-19 cases in Santa Clara County, California.tab|output_row=-1|output_column=deaths}}&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;code&amp;gt;lookup&amp;lt;/code&amp;gt; ==&lt;br /&gt;
Returns the value of the cell(s) in one or more output columns of the row matching the search key and column.&lt;br /&gt;
&lt;br /&gt;
This function is reminiscent of &amp;lt;code&amp;gt;LOOKUP()&amp;lt;/code&amp;gt; macros in popular spreadsheet applications, except that the search key must match exactly. (On the other hand, this means the table does not need to be sorted.)&lt;br /&gt;
&lt;br /&gt;
Usage: {{mlx|{{BASEPAGENAME}}|&amp;#039;&amp;#039;lookup&amp;#039;&amp;#039;|&amp;#039;&amp;#039;Page name.tab&amp;#039;&amp;#039;|search_value{{=}}&amp;#039;&amp;#039;Value to find in column&amp;#039;&amp;#039;|search_column{{=}}&amp;#039;&amp;#039;Name of column to search in&amp;#039;&amp;#039;|output_column{{=}}&amp;#039;&amp;#039;Name of column to output&amp;#039;&amp;#039;|output_column2{{=}}&amp;#039;&amp;#039;Name of another column to output&amp;#039;&amp;#039;|output_column&amp;#039;&amp;#039;n&amp;#039;&amp;#039;{{=}}…|output_format{{=}}&amp;#039;&amp;#039;[[mw:Extension:Scribunto/Lua reference manual#string.format|String format]] to format the output&amp;#039;&amp;#039;}}&lt;br /&gt;
&lt;br /&gt;
If multiple columns are output without an explicit string format, this function formats the output as a human-readable list.&lt;br /&gt;
&lt;br /&gt;
Some may find {{tl|Tabular query}} (which uses this module) an intuitive way to obtain cell data as it resembles a simple [[SQL]] query.&lt;br /&gt;
&lt;br /&gt;
=== Parameters ===&lt;br /&gt;
; {{para|1}} : Page name on Commons with extension but no namespace&lt;br /&gt;
; {{para|search_value}} or {{para|search_pattern}} : Value to find or [[mw:Extension:Scribunto/Lua reference manual#Patterns|pattern to match]] in column&lt;br /&gt;
; {{para|search_column}} : Name of column to search in&lt;br /&gt;
; {{para|occurrence}} : Index of the match to output in case of multiple matching rows. A row index of &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; refers to the first matching row. A row index of &amp;lt;code&amp;gt;-1&amp;lt;/code&amp;gt; refers to the last matching row. It is an error to specify a row index of &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;.&lt;br /&gt;
; {{para|output_column}} or {{para|output_column1}}, {{para|output_column2}}, ... : Names of columns to output&lt;br /&gt;
; {{para|output_format}} : [[mw:Extension:Scribunto/Lua reference manual#string.format|String format]] to format the output&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&lt;br /&gt;
Total confirmed case count in [[c:Data:COVID-19 cases in Santa Clara County, California.tab]] on the day that the county issued a [[stay-at-home order]]:&lt;br /&gt;
&lt;br /&gt;
{{#invoke:Demo|module|demo_module={{BASEPAGENAME}}|demo_module_func=lookup|COVID-19 cases in Santa Clara County, California.tab|search_value=2020-03-16|search_column=date|output_column=cases}}&lt;br /&gt;
&lt;br /&gt;
The last day that a hundred or more patients with COVID-19 were in the hospital in [[c:Data:COVID-19 cases in Solano County, California.tab]]:&lt;br /&gt;
&lt;br /&gt;
{{#invoke:Demo|module|demo_module={{BASEPAGENAME}}|demo_module_func=lookup|COVID-19 cases in Solano County, California.tab|search_pattern=%d%d%d|search_column=hospitalized|occurrence=-1|output_column=date}}&lt;br /&gt;
&lt;br /&gt;
Total number of administrators on all Wikimedia wikis using [[c:Data:Wikipedia statistics/data.tab]]:&lt;br /&gt;
&lt;br /&gt;
{{#invoke:Demo|module|demo_module={{BASEPAGENAME}}|demo_module_func=lookup|Wikipedia statistics/data.tab|search_value=total.all|search_column=site|output_column=admins}}&lt;br /&gt;
&lt;br /&gt;
Number of administrators and users on all Wikimedia wikis using [[c:Data:Wikipedia statistics/data.tab]]:&lt;br /&gt;
&lt;br /&gt;
{{#invoke:Demo|module|demo_module={{BASEPAGENAME}}|demo_module_func=lookup|Wikipedia statistics/data.tab|search_value=total.all|search_column=site|output_column=admins|output_column2=users|output_format=%d out of %d users are administrators}}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Note: Wikipedia statistics are shown as an illustration only. In practice, there is a high-performance module {{tlx|NUMBEROF}} to access Wikipedia statistics.&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;code&amp;gt;wikitable&amp;lt;/code&amp;gt; ==&lt;br /&gt;
{{Tracked|T252307}}&lt;br /&gt;
&lt;br /&gt;
Returns the entire data table as a (rather plain) table.&lt;br /&gt;
&lt;br /&gt;
Usage: {{mlx|{{BASEPAGENAME}}|&amp;#039;&amp;#039;wikitable&amp;#039;&amp;#039;|&amp;#039;&amp;#039;Page name.tab&amp;#039;&amp;#039;}}&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&lt;br /&gt;
{{Collapse top|COVID-19 statistics in Santa Clara County, California}}&lt;br /&gt;
{{#invoke:Demo|module|demo_module={{BASEPAGENAME}}|demo_module_func=wikitable|COVID-19 cases in Santa Clara County, California.tab}}&lt;br /&gt;
{{Collapse bottom}}&lt;br /&gt;
&lt;br /&gt;
=== Implementation notes ===&lt;br /&gt;
&lt;br /&gt;
The implementation of this function incorporates {{tl|n/a}} (to represent null values), {{tl|yes}} (true), and {{tl|no}} (false). The templates themselves cannot be reused because they are incompatible with the [[mw:Extension:Scribunto/Lua reference manual#HTML library|&amp;lt;code&amp;gt;mw.html&amp;lt;/code&amp;gt;]] library, which builds the table using an HTML DOM instead of pure wikitext.&lt;br /&gt;
&lt;br /&gt;
== Internationalization ==&lt;br /&gt;
You can most likely port this template to a wiki in another language without making major modifications. The &amp;lt;code&amp;gt;wikitable&amp;lt;/code&amp;gt; function automatically localizes the table&amp;#039;s description, column titles, and license name into the wiki&amp;#039;s content language. It also formats numbers according to the content language. However, you should localize the cells representing &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt; by changing the values in the &amp;lt;code&amp;gt;messages&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;bgColors&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;colors&amp;lt;/code&amp;gt; variables to match the wiki&amp;#039;s own {{tl|yes}}, {{tl|no}}, and {{tl|n/a}} templates, respectively.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* {{tl|NUMBEROF}}&lt;br /&gt;
* {{T|Last tab}} and {{T|Date tab}}&lt;br /&gt;
* [[:sv:Template:Json2table]] – shows a complete table (based on [[:sv:Module:Json2table]], in turn based on [[Wikipedia:Templates for discussion/Log/2020 June 22#Template:Json2table|a deleted module]])&lt;br /&gt;
* [[Template:Wdtable row]] – fetches a table row from Wikidata in realtime&lt;br /&gt;
* [[Template:Wikidata list]] – uses a bot to periodically fetch a complete table from Wikidata&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{#ifeq:{{SUBPAGENAME}}|sandbox | |&lt;br /&gt;
&amp;lt;!-- Categories below this line, please; interwikis at Wikidata --&amp;gt;&lt;br /&gt;
[[Category:Modules using tabular data]]&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>imported&gt;Mxn</name></author>
	</entry>
</feed>