Template:GetPestsCatP
The template is part of the Template:PestListB and is equivalent to Template:GetBeneficialCatN. It takes the pagename of a pest and tests if the name is assigned one of the following 10 higher categories:
- Coleoptera
- Hemiptera - Cicadomorpha
- Hemiptera - Fulgoromorpha
- Hemiptera - Heteroptera (plantsucking)
- Hemiptera - Sternorrhyncha
- Diptera (plant parasitic)
- Lepidoptera
- Other insect orders (plant/storage pests)
- Veterinary/medical pests
- Other pests
If yes, it adds the above number of the category found to the pagename, e.g. for "Helicoverpa armigera" it returns "7,Helicoverpa armigera". If no category is found it adds the number "99" to the pagename.
The template uses the query
{{#ask:[[Category:<higher category>]][[<pest pagename>]]|format=count}}
to test an assignment. It can cause unexpected results if the pest is assigned to several categories. To avoid such problems beneficials and pests/diseases/weeds should not be assigned to several categories unless they have the same higher groups.
The equivalent templates for diseases and weeds are Template:GetPestsCatD and Template:GetPestsCatW.