Template:ID to name: Difference between revisions

From Caves of Qud Wiki
Jump to navigation Jump to search
(limit to one)
(excluded template/usernamespace)
Line 1: Line 1:
<includeonly>{{#sub:{{#cargo_query:table={{{2|ItemsTable}}}|
<includeonly>{{#sub:{{#cargo_query:table={{{2|ItemsTable}}}|
fields={{#switch: {{{2|temsTable}}} | Corpses=StrippedTitle | Cybernetics=Name| _pageName='Page'}}|
fields={{#switch: {{{2|temsTable}}} | Corpses=StrippedTitle | Cybernetics=Name| _pageName='Page'}}|
where={{#switch: {{{2|ItemsTable}}}| ItemsTable=ObjectID| Mods=ModID| Mutations=MutationID | Factions=FactionID | Corpses=CorpseID | Cybernetics=CyberneticID | ObjectID }}='{{{1|}}}'|limit='1',format=template|template=single query result|nohtml}}}}</includeonly><noinclude>[[Category:Templates]]
where={{#switch: {{{2|ItemsTable}}}| ItemsTable=ObjectID| Mods=ModID| Mutations=MutationID | Factions=FactionID | Corpses=CorpseID | Cybernetics=CyberneticID | ObjectID }}='{{{1|}}}' and _pageNamespace <> '2' and _pageNamespace <> '10'|format=template|template=single query result|nohtml}}}}</includeonly><noinclude>[[Category:Templates]]
Basic implementation that searches the objectid in ItemsTable and returns the page name in plain text.
Basic implementation that searches the objectid in ItemsTable and returns the page name in plain text.



Revision as of 13:21, 1 August 2019

Basic implementation that searches the objectid in ItemsTable and returns the page name in plain text.

{{ID to name|Cyclopean Prism}}

output: Amaranthine prism

This defaults to Items table, but can search other tables given that they have their own ID in by specifying the table as the second argument:

{{ID to name|Human Corpse|Corpses}}

output:

Error: No field named "StrippedTitle" found for any of the specified database tables.