Module:CargoQuery/doc

From Support Wiki
Jump to navigation Jump to search

This is the documentation page for Module:CargoQuery

This module lets you get around the |no html bug that Cargo has by avoiding |format=template.

To use, preface query arguments with q?. Even if you are only using one table, use |q?tables=. You must specify the template that will handle each row of the query result using |template=. You may additionally specify |intro=, |outro=, |delimiter=, and |default=.

Use Lua names of all query parameters, so |q?join=, |q?groupBy, etc.

For simplicity of code, the named args parameter is required to be Yes, and you do not need to specify it.

Unlike |format=template, this wrapper will NOT rename parameters with underscores in them to use spaces instead.

Parameters & Invocation

{{#invoke:CargoQuery|main
|tables= 	<!-- corresponds to table / tables -->
|join= 	<!-- corresponds to join on -->
|fields= 	<!-- corresponds to fields -->
|where= 	<!-- corresponds to where -->
|groupBy= 	<!-- corresponds to group by -->
|having= 	<!-- corresponds to having -->
|orderBy= 	<!-- corresponds to order by -->
|limit= 	<!-- corresponds to limit -->
|template=      <!-- pagename of template (required). remember to name your args! -->
|intro=
|outro=
|delimiter=
|default=
}}

Additionally, if you have one-to-many data, you may specify these parameters:

 |one_to_many=
 |one_to_many_group=
 |one_to_many_sep=,

For example, if you have many Citys for every one Kingdom, you might supply:

 |one_to_many=City
 |one_to_many_group=Kingdom
 |one_to_many_sep=,

And then for the Kingdom="Skyrim" line, you'd get |City=Whiterun,Riften,...