Module:CargoQuery/doc: Difference between revisions

update for to most recent
mNo edit summary
 
(4 intermediate revisions by the same user not shown)
Line 30: Line 30:
</pre>
</pre>
Here, the <code>one_to_many</code> is a list of players on the team in question. For each ONE team, there are MANY players, so the field <code>IDs</code> that's sent to the template is a comma-separated list of players, grouped by team page.
Here, the <code>one_to_many</code> is a list of players on the team in question. For each ONE team, there are MANY players, so the field <code>IDs</code> that's sent to the template is a comma-separated list of players, grouped by team page.
== Compound Queries ==
You can also run compound queries using <code>compound</code>. It has the same syntax as <code>#cargo_compound_query</code> but with a few exceptions:
* <code>default</code> for each individual query is disabled; default must be specified outside as an additional argument, which is then applied if no queries return results.
* Each query must be numbered as in <code>|1=(query1)|2=(query2)|3=...</code>, etc.
* Because of how compound query uses <code>;</code> as a separator, strings with this character cannot be used. This can be worked around by specifying <code>metaseparator</code> to be another symbol, and splitting each query's arguments using that delimiter instead.
=== Example ===
<pre>
{{#invoke:CargoQuery|compound
|1=table=Food=F
;fields=F._pageName=Page
;where=F.CookEffect HOLDS 'heat and fire-based' AND F._pageNamespace = '0'
|2=table=Liquids=L
;fields=L._pageName=Page
;where=L.CookEffect HOLDS 'simple heat and fire-based' AND L._pageNamespace = '0'
|default=No Results!
|template=favilink page
|delimiter = <br>
|metaseparator = ;
}}
</pre>
<includeonly>
<includeonly>
[[Category:Modules]]
[[Category:Modules]]
</includeonly>
</includeonly>