Template:QueryCondition4b

From Pestinfo-Wiki
Jump to: navigation, search

This template is equivalent to Template:QueryCondition4p and is used for the Template:LiteratureDB1. It determines a suitable query condition for the publication years to display the recent articles for a given beneficial. It should be called as:

{{QueryCondition4b|{{PAGENAME}}}}

It will check the number of recent articles assigned to the beneficial and will produce a suitable year for a query condition. The number of publications after this year should not exceed 40. The template has the following structure:

1. Define the variable "PubNumber" as the total number of articles assigned to the beneficial
{{#vardefine:PubNumber|{{#ask: [[Category:Publications]][[Publication on beneficial::{{{1}}}]]
|format=count}}}}

2. If "PubNumber" < 41 display all articles (that is after 1700)
{{#ifexpr: {{#var:PubNumber}} < 41 |1700

3. More than 40 articles, repeat query for publications later than 2005
| {{#vardefine:PubNumber|{{#ask: [[Category:Publications]][[Publication on beneficial::{{{1}}}]]
     [[Publication year::>2006]]|format=count}}}}

   4. If "PubNumber" < 41 display articles for that period provided there are some
   {{#ifexpr: {{#var:PubNumber}} < 41 |
       {{#ifexpr:{{#var:PubNumber}}>0|2006|1700}}

   5. More than 40 articles, repeat query for publications of last 3 year
   | {{#vardefine:PubNumber|{{#ask: [[Category:Publications]][[Publication on beneficial::{{{1}}}]]
        [[Publication year::>{{#expr:{{CURRENTYEAR}}-2}}]]|format=count}}}}

      6. If "PubNumber" < 41 display articles for that period provided there are some
      {{#ifexpr: {{#var:PubNumber}} < 41 |
          {{#ifexpr:{{#var:PubNumber}}>0|{{#expr:{{CURRENTYEAR}}-2}}|2006}}

       7. More than 40 articles, display articles for last 2 years
       |{{#expr:{{CURRENTYEAR}}-1}}

      }} (end if condition 6)
   }} (end if condition 4)
}} (end of condition 2)