Difference between revisions of "Presage/Internal:Great American Date Codes"
Hheffelbower (talk | contribs) |
Hheffelbower (talk | contribs) |
||
Line 50: | Line 50: | ||
The code above references a choice {?Date Code Format} techs select against the {?Check Timestamp} in an analysis. The date format is compared against a code on the product's packaging the tech enters into the Ideal Date Code option. This assures the product packaging is labeled properly. An option name must always be preceeded by '{?' and followed by '}' to be recognized as an analysis option. [This link https://www.w3schools.com/SQL/func_date_format.asp] offers a list of date formats for MySQL. | The code above references a choice {?Date Code Format} techs select against the {?Check Timestamp} in an analysis. The date format is compared against a code on the product's packaging the tech enters into the Ideal Date Code option. This assures the product packaging is labeled properly. An option name must always be preceeded by '{?' and followed by '}' to be recognized as an analysis option. [This link https://www.w3schools.com/SQL/func_date_format.asp] offers a list of date formats for MySQL. | ||
<h2>Best Before/Meilleur Avant | <h2>Best Before/Meilleur Avant YYYY MO DD + Wahoo</h2> | ||
The Nampa plant requested a new date code for a product distributed in Canada. | The Nampa plant requested a new date code for a product distributed in Canada. They requested month abbreviations that are not standard to MySQL. Therefore we used a case statement instead of using the date formats. That code looks like the code below. It concatenates 'Best Before/Meilleur Avant ' with the four-digit year, the two-character month (in the first case statment), the two-digit day, and the Wahoo Date Code (above). | ||
For a date of '''2017-06-05 00:15:01''' (produced on '''Line 1''' in the '''Nampa''' plant), the Date Code would display as ''''Best Before/Meilleur Avant 2018 JN05 NF057J1''''. | |||
{{Code|text=(select case WHEN {?Retail Date Code Format} = "Best Before/Meilleur Avant YYYY MO DD + Wahoo" THEN <br> | {{Code|text=(select case WHEN {?Retail Date Code Format} = "Best Before/Meilleur Avant YYYY MO DD + Wahoo" THEN <br> | ||
CONCAT('Best Before/Meilleur Avant ', DATE_FORMAT(DATE_ADD({?Check Timestamp}, INTERVAL 12 month), '%Y '), LEFT(date_format(date_add({?Check Timestamp}, interval 12 month),<br> | CONCAT('Best Before/Meilleur Avant ', DATE_FORMAT(DATE_ADD({?Check Timestamp}, INTERVAL 12 month), '%Y '), LEFT(date_format(date_add({?Check Timestamp}, interval 12 month),<br> |
Revision as of 16:41, 8 June 2017
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 of the nested 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. (controlled by the second of the nested case statement).
- Finally, the '1' indicates the line number within the plant where the product was produced.
(SELECT CASE CONCAT('N', |
The code above references a choice {?Date Code Format} techs select against the {?Check Timestamp} in an analysis. The date format is compared against a code on the product's packaging the tech enters into the Ideal Date Code option. This assures the product packaging is labeled properly. An option name must always be preceeded by '{?' and followed by '}' to be recognized as an analysis option. [This link https://www.w3schools.com/SQL/func_date_format.asp] offers a list of date formats for MySQL.
Best Before/Meilleur Avant YYYY MO DD + Wahoo
The Nampa plant requested a new date code for a product distributed in Canada. They requested month abbreviations that are not standard to MySQL. Therefore we used a case statement instead of using the date formats. That code looks like the code below. It concatenates 'Best Before/Meilleur Avant ' with the four-digit year, the two-character month (in the first case statment), the two-digit day, and the Wahoo Date Code (above).
For a date of 2017-06-05 00:15:01 (produced on Line 1 in the Nampa plant), the Date Code would display as 'Best Before/Meilleur Avant 2018 JN05 NF057J1'.
(select case WHEN {?Retail Date Code Format} = "Best Before/Meilleur Avant YYYY MO DD + Wahoo" THEN CONCAT('Best Before/Meilleur Avant ', DATE_FORMAT(DATE_ADD({?Check Timestamp}, INTERVAL 12 month), '%Y '), LEFT(date_format(date_add({?Check Timestamp}, interval 12 month), |