Lompat ke isi

Cèṭa'an:Ifnoteq then show/doc

Ḍâri Wikipèḍia bhâsa Madhurâ, lombhung pangataowan mardhika

TemplateStyles' src attribute must not be empty.

This template tests whether the first unnamed parameter is equal to the second unnamed parameter and returns the third unnamed parameter if it does. Otherwise it returns the first unnamed parameter.

This is useful when the first parameter is a {{#invoke: }} of a Lua module that returns a value for which a specific exception is required. Because it uses the {{#invoke: }} just once, it simplifies the coding of infoboxes, for example.

An infobox field may return the negara (P17) for an article about a city. We may wish to use the abbreviation "USA" in place of "United States".

negara (P17) for York (Q42462)
{{#invoke:WikidataIB |getValue |P17 |qid=Q42462 |fwd=ALL |osd=no |rank=best |noicon=true}}Lua error in Modul:WikidataIB at line 94: attempt to call field 'loadI18n' (a nil value).
{{Ifnoteq then show|{{#invoke:WikidataIB |getValue |P17 |qid=Q42462 |fwd=ALL |osd=no |rank=best |noicon=true}}|United Kingdom|UK}}Lua error in Modul:WikidataIB at line 94: attempt to call field 'loadI18n' (a nil value).
negara (P17) for Kota New York (Q60)
{{#invoke:WikidataIB |getValue |P17 |qid=Q60 |fwd=ALL |osd=no |rank=best |noicon=true}}Lua error in Modul:WikidataIB at line 94: attempt to call field 'loadI18n' (a nil value).
{{Ifnoteq then show|{{#invoke:WikidataIB |getValue |P17 |qid=Q60 |fwd=ALL |osd=no |rank=best |noicon=true}}|United States|USA}}Lua error in Modul:WikidataIB at line 94: attempt to call field 'loadI18n' (a nil value).