Cargo Queries

From Salish Sea Wiki

See also Page Editing Forms

This page has information about using structure data created thorugh page edit forms to complete queries


Syntax

{{#cargo_query:
tables=table1=tableAlias1, table2=tablesAlias2, etc.
|join on=table1.fieldA = table2.fieldB,table2.fieldC=table3.fieldD, etc.
|fields=field1=fieldAlias1,field2=Alias2, etc.
|where=table1.fieldE='some value' AND/OR etc.
|group by=table1.fieldG
|having=table1.fieldG='some value', etc.
|order by=table2.fieldF, etc.
|limit=some number
|offset=some number
|intro=some text
|outro=some text
|default=some text
|more results text=some text
|no html
|max display chars=some number
|format=format
...additional format-based parameters
}}


  • Product Query
  • {{#cargo_query:tables=Products|fields=COUNT(*)|where=Type_Group='Dataset'}} - creates a count of pages fitting a query

Query

All Products where "Authors" = "Cereghino". Note, since we didn't split by Authors, we can't always pull where they are also included, but we might use a match vs. equals to get this.

{{#cargo_query:
tables=Products
|fields=_pageName=Page
|where=Authors='Cereghino'
|format=ul
}}

Dynamic Table

{{#cargo_query:
tables=Products
|fields=_pageName=Page,Type_Group=Type,Authors,Categories
|format=dynamic table
|rows per page=20
|searchable columns=yes
|limit=1000
}}