Template:RelatedReports: Difference between revisions

From Avi's Drug Diary
Created page with "<includeonly> ---- == Related Reports == {{{reports|No related reports yet.}}} </includeonly> <noinclude> Parameters: * reports= </noinclude>"
 
Implement Cargo-backed related reports
Line 1: Line 1:
<includeonly>
<includeonly>
----
----
== Related Reports ==
== Related Reports ==
 
{{#if:{{{reports|}}}
{{{reports|No related reports yet.}}}
|{{{reports}}}
 
|{{#if:{{{substance1|}}}
|<ul>
{{#cargo_query:
tables=Reports
|fields=_pageName=page,Title=title,ReportType=type,PrimarySubstances=substances
|where=_pageName<>'{{FULLPAGENAME}}' AND (PrimarySubstances HOLDS '{{{substance1}}}'{{#if:{{{substance2|}}}| OR PrimarySubstances HOLDS '{{{substance2}}}'}}{{#if:{{{substance3|}}}| OR PrimarySubstances HOLDS '{{{substance3}}}'}}{{#if:{{{substance4|}}}| OR PrimarySubstances HOLDS '{{{substance4}}}'}}{{#if:{{{substance5|}}}| OR PrimarySubstances HOLDS '{{{substance5}}}'}})
|order by=_pageID DESC
|limit={{{limit|15}}}
|format=template
|template=RelatedReportRow
|named args=yes
|delimiter=
|more results text=
|default=<li><em>No related reports yet.</em></li>
}}
</ul>
|<em>No related reports yet.</em>
}}
}}
</includeonly>
</includeonly>
<noinclude>
Automatically lists other reports that share primary substances.


<noinclude>
Parameters:
Parameters:
* <code>substance1</code>…<code>substance5</code> — substance names to match (at least substance1)
* <code>limit</code> — max results (default 15)
* <code>reports</code> — optional manual override (wikitext); when set, Cargo query is skipped


* reports=
Example:
<pre>
{{RelatedReports
|substance1=NEP
|substance2=Ketamine
}}
</pre>
</noinclude>
</noinclude>

Revision as of 18:24, 9 August 2026


Automatically lists other reports that share primary substances.

Parameters:

  • substance1substance5 — substance names to match (at least substance1)
  • limit — max results (default 15)
  • reports — optional manual override (wikitext); when set, Cargo query is skipped

Example:

{{RelatedReports
|substance1=NEP
|substance2=Ketamine
}}