Opened 3 years ago
Closed 21 months ago
#2934 closed enhancement (fixed)
Add fields to Inventory_viability_label dataview
| Reported by: | Stacey | Owned by: | Benjamin Haag |
|---|---|---|---|
| Priority: | medium | Milestone: | ADCOM PRIORITY 2025 |
| Component: | Database, Data Updates | Version: | N/A |
| Severity: | Keywords: | Label Viability Wizard | |
| Cc: | lisa.pfiffner@…, lisa.burke@… | Database Engine: | N/A |
| Operating System: | N/A |
Description
Add new fields to the 'get_inventory_viability_label' dataview:
inventory viability rule
accession (concatenated prefix / number / suffix)
maybe secondary ID (accession plant_name)
so these fields can be added to the viability rep labels. See attachment.
Attachments (2)
Change History (11)
by , 3 years ago
| Attachment: | GRIN-Global Viability Label Enhancements.png added |
|---|
comment:1 by , 22 months ago
| Cc: | added |
|---|
AT error when attempting to modify dataview on dev (see attached screen shot).
by , 22 months ago
| Attachment: | Trac_2934_AT_Error_Devjpg.jpg added |
|---|
comment:2 by , 22 months ago
\
SQL edit below for review.
SELECT TOP 100
ROW_NUMBER() OVER (ORDER BY iv.inventory_viability_id, rn.rownum) AS label_id
,LTRIM(RTRIM(LTRIM(COALESCE(a.accession_number_part1, '') + ' ') + LTRIM(COALESCE(convert(varchar, a.accession_number_part2), '') + ' ') + COALESCE(a.accession_number_part3, ''))) AS accession
,iv.inventory_viability_id AS inventory_viability_id
,ROW_NUMBER() OVER (PARTITION BY iv.inventory_viability_id ORDER BY iv.inventory_viability_id, rn.rownum) AS replication_number
,iv.inventory_id AS inventory_id
,(SELECT MAX(ori.order_request_id) FROM order_request_item ori LEFT JOIN order_request o ON ori.order_request_id = o.order_request_id WHERE o.order_type_code IN ('GR') AND iv.inventory_id = ori.inventory_id) AS order_request_id
,a.taxonomy_species_id AS taxonomy_species_id
,i.inventory_number_part1 AS inventory_number_part1
,i.inventory_number_part2 AS inventory_number_part2
,i.inventory_number_part3 AS inventory_number_part3
,i.form_type_code AS form_type_code
,i.inventory_id AS inventory_id_string
,irv.name AS inventory_viability_rule
FROM
inventory_viability iv
LEFT JOIN inventory i ON iv.inventory_id = i.inventory_id
LEFT JOIN accession a ON i.accession_id = a.accession_id
LEFT JOIN inventory_viability_rule irv ON iv.inventory_viability_rule_id = irv.inventory_viability_rule_id
CROSS APPLY (SELECT TOP(CAST(COALESCE(iv.replication_count, 1) AS INT)) code_value_id AS rownum FROM code_value) AS rn
WHERE
iv.inventory_viability_id IN (:inventoryviabilityid)
comment:3 by , 22 months ago
@Benjamin - Promote that code to DEV for testing.
SQL looks good and works for both Pete and me.
comment:4 by , 22 months ago
| Milestone: | → ADCOM PRIORITY 2025 |
|---|---|
| Status: | new → addressed |
Dataview viability_wizard_get_inventory_viability_label updated on dev.
comment:6 by , 21 months ago
| Resolution: | → fixed |
|---|---|
| Status: | addressed → closed |
Dataview viability_wizard_get_inventory_viability_label deployed to prod.
comment:8 by , 21 months ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
Benjamin, please revise the first line of SQL you posted for review on 1/23/2025. Specifically, the line is currently 'SELECT TOP 100' but should be simply 'SELECT'. This will enable viability print jobs to exceed 100 labels. Thanks!!!
comment:9 by , 21 months ago
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
Removed test SQL incorrectly left in dataview source.

Viability Label dataview changes