How to Retrieve Tracking Number for an Order from Notes

How to Retrieve Tracking Number for an Order from Notes

Release Date: 12/13/2017

Q - Can you let me know how the tracking number is stored in Elliott so I can use query to retrieve the information?

A - Regarding how Elliott stores tracking numbers, please refer to the following Knowledge Base article:


You can retrieve the tracking number by using the SQL SELECT statement as follows:

SELECT * FROM NOTES
WHERE NOTE_FILE_NAME = 'CPORDHDR' AND
NOTE_FILE_REF_NO = RIGHT(CONCAT('000000',CONVERT(#ORD_NO#,SQL_CHAR)),6) AND
NOTE_CREATE_BY_USER = 'STARSHIP';

Substitute the #ORD_NO# with Elliott's order number.  We assume #ORD_NO# is in numeric or integer format. Keep in mind we store order numbers with padded leading zeroes in NOTE_FILE_REF_NO to 6 digits. That is to say, order# 1234 is stored in 001234 in NOTE_FILE_REF_NO, which is a string field. So the RIGHT(CONCAT('000000',CONVERT(#ORD_NO#,SQL_CHAR)),6) will pad leading zeroes to #ORD_NO# and make it a string value to match the data type of NOTE_FILE_REF_NO.

Also, keep in mind that some users' nightly deferred processing routine will post and purge invoiced orders and move them to invoice history. So the above procedure may only work from the time that the order is manifest (during the day) to the time when the order is posted and purged (somewhere around midnight). After mid-night, the order could be moved to two places: (1) Invoice History; (2) Order History. Invoice History is referenced by invoice number.

If you have the order number, then the Order History is a better candidate. So if the query above does not work, you will use the following query:

SELECT * FROM NOTES
WHERE NOTE_FILE_NAME = 'CPHODHDR' AND
NOTE_FILE_REF_NO = RIGHT(CONCAT('000000',CONVERT(#ORD_NO#,SQL_CHAR)),6) AND
NOTE_CREATE_BY_USER = 'STARSHIP';

If you have the invoice number, then the invoice history is a better choice. So you can use the following query:

SELECT * FROM NOTES
WHERE NOTE_FILE_NAME = 'CPINVHDR' AND
NOTE_FILE_REF_NO = RIGHT(CONCAT('000000',CONVERT(#INV_NO#,SQL_CHAR)),6) AND
NOTE_CREATE_BY_USER = 'STARSHIP';

The following Knowledge Base article may relate to you if you wish to join the NOTES and CPINVHDR table to retrieve both tracking and invoice header info:


EMK





    • Related Articles

    • Using Markdown Language in Freeform Notes

      Released: 3/17/2025 Versions: Elliott V8.6 and Higher Background Some exciting new Elliott technology is coming. One part of this new technology will make use of existing Elliott Notes, but the content will be presented in a richer format. Beginning ...
    • Shipment Confirmation Email Shows FedEx URL for UPS Tracking Number

      Release Date: 02/06/2024 Version: 7.x & Up Q - How is the URL used in the shipment confirmation email determined? We have a case where the FedEx URL is used for a UPS shipment, which obviously doesn’t work. See sample below: A - Elliott tries to ...
    • Allow Auto Popup Customer or Item Notes in Order Entry with Read Only Option

      Release Date: 11/25/2020 Version: 8.5 & Up In Global Setup -> System -> Note Function, there are these two flags: 23. Auto Pop Up Customer Note During Order Entry? 24. Auto Pop Up Item Note During Line Item Entry? In addition to "Y" or "N," we now ...
    • DN API (Document Number Handling)

      Release: 1/11/2021 Version: V8.5 and higher DN API: Document Number Increase, Roll Back or Validate In Elliott V8.5, the system supports alphabetic document numbers. The logic to sequentially assigning the next document number is complicated. For ...
    • Alpha Document Number Support (V8.5/V9.0)

      V8.5/V9.0 offers support for alpha numeric document numbers. This gives the user more flexibility on the number of alphabetic characters in next document number. For example, in the scenario of the following “Starting Invoice Number” in A/R Setup: ...