Great American [Appetizers] Snacks has unique date codes for their packaging.
The Wahoo Date Code
The Wahoo code is used in both the Nampa and Monroe plants for a number of analysis. For a date of 2017-06-05 00:15:01 (produced on Line 1 in the Nampa plant), the Wahoo Code would display as 'NF057J1'
- The 'N' stands for Nampa. The Monroe plant's initial character is 'M'.
- The 'F' stands for the month of June (controlled by the first case statement).
- The '05' is the day of the month formatted as a two-digit day using the format '%d'.
- The '7' is the last number of the four-digit year using the RIGHT command to find the first digit on the right of the number, using the format '%y'.
- The 'J' represents the time between midnight and 2 a.m. using the second case statement.
- Finally, the '1' indicates the line number within the plant where the product was produced.
(SELECT
CASE
WHEN {?Date Code Format} = "Wahoo" THEN
CONCAT('N',
CASE
WHEN DATE_FORMAT({?Check Timestamp},'%c') = 1 THEN 'A'
WHEN DATE_FORMAT({?Check Timestamp},'%c') = 2 THEN 'B'
WHEN DATE_FORMAT({?Check Timestamp},'%c') = 3 THEN 'C'
WHEN DATE_FORMAT({?Check Timestamp},'%c') = 4 THEN 'D'
WHEN DATE_FORMAT({?Check Timestamp},'%c') = 5 THEN 'E'
WHEN DATE_FORMAT({?Check Timestamp},'%c') = 6 THEN 'F'
WHEN DATE_FORMAT({?Check Timestamp},'%c') = 7 THEN 'G'
WHEN DATE_FORMAT({?Check Timestamp},'%c') = 8 THEN 'H'
WHEN DATE_FORMAT({?Check Timestamp},'%c') = 9 THEN 'I'
WHEN DATE_FORMAT({?Check Timestamp},'%c') = 10 THEN 'J'
WHEN DATE_FORMAT({?Check Timestamp},'%c') = 11 THEN 'K'
WHEN DATE_FORMAT({?Check Timestamp},'%c') = 12 THEN 'L'
END,
date_format({?Check Timestamp},'%d'),
RIGHT(DATE_FORMAT({?Check Timestamp},'%y'),1),
CASE
WHEN DATE_FORMAT({?Check Timestamp},'%T') BETWEEN '05:00:00' AND '07:59:59' THEN 'A'
WHEN DATE_FORMAT({?Check Timestamp},'%T') BETWEEN '08:00:00' AND '09:59:59' THEN 'B'
WHEN DATE_FORMAT({?Check Timestamp},'%T') BETWEEN '10:00:00' AND '11:59:59' THEN 'C'
WHEN DATE_FORMAT({?Check Timestamp},'%T') BETWEEN '12:00:00' AND '13:59:59' THEN 'D'
WHEN DATE_FORMAT({?Check Timestamp},'%T') BETWEEN '14:00:00' AND '15:59:59' THEN 'E'
WHEN DATE_FORMAT({?Check Timestamp},'%T') BETWEEN '16:00:00' AND '17:59:59' THEN 'F'
WHEN DATE_FORMAT({?Check Timestamp},'%T') BETWEEN '18:00:00' AND '19:59:59' THEN 'G'
WHEN DATE_FORMAT({?Check Timestamp},'%T') BETWEEN '20:00:00' AND '21:59:59' THEN 'H'
WHEN DATE_FORMAT({?Check Timestamp},'%T') BETWEEN '22:00:00' AND '23:59:59' THEN 'I'
WHEN DATE_FORMAT({?Check Timestamp},'%T') BETWEEN '00:00:00' AND '01:59:59' THEN 'J'
WHEN DATE_FORMAT({?Check Timestamp},'%T') BETWEEN '02:00:00' AND '03:59:59' THEN 'K'
WHEN DATE_FORMAT({?Check Timestamp},'%T') BETWEEN '04:00:00' AND '04:59:59' THEN 'L'
END,
{?Line})
END)
|
Best Before/Meilleur Avant 2018 JN05 NF057J1