﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	db_engine	os_version
1811	taxonomy species citation lookup change	Melanie Schori	Kurt Endress	"Please modify the SQL for taxonomy_species_citation_lookup. The current SQL is below:

SELECT
  cit.citation_id AS value_member,
  COALESCE('. ' + l.abbreviation, '')
    + COALESCE( '. ' + COALESCE(cit.citation_title, cit.title), '')
    + COALESCE(cit.author_name, 'Unrecorded Author')
    + COALESCE( '. ' + CONVERT(NVARCHAR, cit.citation_year), '')
    + COALESCE( '. ' + cit.reference, '')
    AS display_member,
  cit.taxonomy_species_id,
  ts.current_taxonomy_species_id
FROM
  citation cit
  LEFT JOIN literature l ON cit.literature_id = l.literature_id
  INNER JOIN taxonomy_species ts ON cit.taxonomy_species_id = ts.taxonomy_species_id

Changed SQL:

SELECT
  cit.citation_id AS value_member,
  COALESCE('. ' + l.abbreviation, '') //can the initial '. ' be removed?//
//add CASE statement here with COALESCE to check for and display citation.type_code//
    + COALESCE( '. ' + CONVERT(NVARCHAR, cit.citation_year), '') //moved up//
    + COALESCE( '. ' + COALESCE(cit.citation_title, cit.title), '')
    + COALESCE(cit.author_name, '') //Unrecorded Author removed//
    + COALESCE( '; ' + cit.reference, '') //first coalesce option changed from . to ;//
    AS display_member,
  cit.taxonomy_species_id,
  ts.current_taxonomy_species_id
FROM
  citation cit
  LEFT JOIN literature l ON cit.literature_id = l.literature_id
  INNER JOIN taxonomy_species ts ON cit.taxonomy_species_id = ts.taxonomy_species_id

1. I would like the initial '. ' to be removed because it prevents me from typing the initial letter of the reference I want as a means of opening the lookup picker

2. The citation type_code needs to be added so we can distinguish between NULL, 'RELATIVE', 'NODULATION', AND 'MEDICINAL'. Rather than display the full type code, please use a CASE statement to return '. ' + cit.type_code using 'CWR' for 'RELATIVE', 'NOD' for 'NODULATION', and 'MED' for 'MEDICINAL'.

3. I would like the year to appear after the type code.

4. 'Unrecorded Author' is completely unhelpful and can be removed.

5. Author names often finish with a '.', so adding another '. ' directly after is not helpful. I would prefer a semicolon instead.

Please let me know if there are potential problems created by any of these changes."	enhancement	closed	medium	Server 1.10.5	Dataviews (CT)	N/A		fixed			N/A	N/A
