Template:CommonData/Joins

The generates wiki code from a combination of data sources in one command, to assist in template maintenance. See Template:/Rows for more information. See also Template: for general information and a lists of other commands.


 * Usage
 * 1 - join expression from data categories
 * 2 - field name to use to match the lookup key
 * 3 - lookup key
 * ... additional 'and' key value lookups, 4 5, 6 7, up to 3 total
 * wiki - wiki code with replaceable values to have transcluded
 * limit - number limit of returned transcluded rows. Default is 800. 0 is all.
 * default - default wiki code if any, to use if no result is found
 * vars - list of fields to make variables, without having to mention in wiki=
 * istable - if set, enables additional wiki table row and cell markup
 * source - if set, render to wiki code source that can be copy-pasted
 * Returns transcluded 'wiki code' based on first matching data found. If no data then the result will be empty.

See Template:/Rows for detail on these common arguments.

Additional syntax
 * Value replacement {{#var notation with Join or Joins is enhanced to allow data source selection for which version of the same field to choose from. The normal rule is that a matching field in the last data source selected is the one that's used in the '|wiki=' section for value replacement. Join and Joins add a data source selector for choosing a specific data source field, like {{#var:Maps.AreaID}} where Instances and Maps both have the 'AreaID' field, and the notation in this example would ensure that the 'Maps' version was selected if both data sources were in the 'Join' list.

Joined rows for relating data
 * Examples

{{Cd/Joins|Areas,Maps,Instances on InstanceID|AreaName|Durotar|wiki= I found area {{#var:Maps.AreaID}} named {{#var:AreaName}} with a minimum level of {{#var:LevelMin|0}}. }}

Independent Row commands for relating data

{{Cd/Row|Areas|AreaName|Durotar|vars=AreaID,AreaName}} {{Cd/Row|Maps|AreaID|{{#var:AreaID}}|vars=LevelMin}}

I found area {{#var:AreaID}} named {{#var:AreaName}} with a minimum level of {{#var:LevelMin|0}}.

Nested Rows for relating data

{{Cd/Row|Areas|AreaName|Durotar|wiki= I found area {{#var:AreaID}} named {{#var:AreaName}} {{#invoke:Cd|GetRow|Maps|AreaID|{{#var:AreaID}}|istable=1|wiki=@nowiki@with a minimum level of {{#var:LevelMin}}@/nowiki@}}. }}

Joined rows for relating data

Independent Row commands for relating data

Nested Rows for relating data

This template could be renamed however it would be better to create a redirect alias due to all of the interconnects between the templates and modules. Redirect names such as {{Cd/Rows}} or {{Data/Rows}} are good choices if not already taken.
 * For Admins and Maintainers

Some of the wiki coding style needed to generate the more complex lookups would be difficult for most casual wiki contributors. In these cases the intent is that admins and maintainers would use CommonData to: For #4 these are often excellent candidates for instead wrapping in a template as mentioned in #1.
 * 1) Make or use existing templates to encapsulate CommonData, such as info boxes, that already hide complex wiki code
 * 2) Use CommonData as a tool to generate base static wiki code that a regular contributor could then edit as normal.
 * 3) The contributor simply manually adds static wiki text and code around a 'Cd/Rows' statement, like to amend a table with more rows or to make a longer list or series.
 * 4) Users learn to recognize, as they do for many templates already, the Cd/Rows idioms that can be copy/pasted where they only need to change a name, a number, or some other static text inside the Cd/Rows call to get the effect they want.

{{#invoke:CommonData|GetJoins|{{{1|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|{{{7|}}}|vars={{{vars|}}}|wiki={{{wiki|}}}|default={{{default|}}}|source={{{source|}}}|istable={{{istable|}}}|limit={{{limit|}}}}}